在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!

 

相关文章:

  • 2021-08-03
  • 2021-10-17
  • 2021-12-30
  • 2021-10-03
  • 2021-07-15
  • 2021-12-07
猜你喜欢
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2021-04-14
  • 2021-08-24
  • 2021-05-29
  • 2021-06-22
相关资源
相似解决方案