zoukankan      html  css  js  c++  java
  • Django web project

    在virtualenv下

    (myvenv) ~/djangogirls$ django-admin startproject mysite .

    生成web 工程目录

    djangogirls
    ├───manage.py
    └───mysite
            settings.py
            urls.py
            wsgi.py
            __init__.py

    设置settings

    TIME_ZONE = 'Asia/Shanghai'
    STATIC_ROOT = os.path.join(BASE_DIR, 'static')
    ALLOWED_HOSTS = ['127.0.0.1', '<your_username>.pythonanywhere.com']

    使用默认数据库

    python manage.py migrate

    开启网络服务

    (myvenv) ~/djangogirls$ python manage.py runserver

     在网页上输入网址

    http://127.0.0.1:8000/

    可以看到

    It worked!
    Congratulations on your first Django-powered page.
    
    Next, start your first app by running python manage.py startapp [app_label].
    You're seeing this message because you have DEBUG = True in your Django settings file and you haven't configured any URLs. Get to work!
  • 相关阅读:
    PHP中关于字符串的连接
    好用的FireFox(FF)插件
    Scripted Operation
    Scripted device
    chgrp chown
    wait_for_devices
    mysql create user
    mysql
    create user mysql
    Inserting/Removing shutters and filters
  • 原文地址:https://www.cnblogs.com/pengyingh/p/7017221.html
Copyright © 2011-2022 走看看