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!