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!
  • 相关阅读:
    Day 03
    Day 03 作业
    Day 02 作业
    Day 02
    Day 01
    Day 10 面向对象基础
    Spring学习-- Bean 的作用域
    一、基本知识
    cloud-init使用技巧
    如何在KVM中管理存储池
  • 原文地址:https://www.cnblogs.com/pengyingh/p/7017221.html
Copyright © 2011-2022 走看看