zoukankan      html  css  js  c++  java
  • 建立第一个Django工程---linux中的python

    建立第一个Django工程
    
    环境:
    
    ip: 192.168.0.92
    
    系统:centos7.5
    
    安装django
    
    pip install django
    
    
    启动一个HelloWorld工程
    
    
    django-admin.py startproject HelloWorld
    
    [root@test2 ~]# ls
    HelloWorld

    查看工程自带的文件
    [root@test2
    ~]# tree . . `-- HelloWorld |-- HelloWorld | |-- __init__.py | |-- __pycache__ | | |-- __init__.cpython-36.pyc | | |-- settings.cpython-36.pyc | | |-- urls.cpython-36.pyc | | `-- wsgi.cpython-36.pyc | |-- settings.py | |-- urls.py | `-- wsgi.py |-- db.sqlite3 `-- manage.py 3 directories, 10 files
    合并
    cd
    /root/HelloWorld/ python manage.py migrate [root@test2 HelloWorld]# python manage.py migrate Operations to perform: Apply all migrations: admin, auth, contenttypes, sessions Running migrations: Applying contenttypes.0001_initial... OK Applying auth.0001_initial... OK Applying admin.0001_initial... OK Applying admin.0002_logentry_remove_auto_add... OK Applying admin.0003_logentry_add_action_flag_choices... OK Applying contenttypes.0002_remove_content_type_name... OK Applying auth.0002_alter_permission_name_max_length... OK Applying auth.0003_alter_user_email_max_length... OK Applying auth.0004_alter_user_username_opts... OK Applying auth.0005_alter_user_last_login_null... OK Applying auth.0006_require_contenttypes_0002... OK Applying auth.0007_alter_validators_add_error_messages... OK Applying auth.0008_alter_user_username_max_length... OK Applying auth.0009_alter_user_last_name_max_length... OK Applying sessions.0001_initial... OK 修改ALLOWED_HOSTS cd /root/HelloWorld/HelloWorld/ [root@test2 HelloWorld]# ls __init__.py __pycache__ settings.py urls.py wsgi.py vi settings.py ALLOWED_HOSTS = ['*'] 将ALLOWED_HOSTS = []改为ALLOWED_HOSTS = ['*'] 启动工程 cd /root/HelloWorld python manage.py runserver 0.0.0.0:8000 浏览器访问:http://192.168.0.92:8000/
  • 相关阅读:
    HDU-3790 最短路径问题(双重权值)
    Graph (floyd)
    POJ-3259 Wormholes(判断负环、模板)
    HDU-1317 XYZZY
    HDU-1548 A strange lift(单源最短路 或 BFS)
    最小生成树(模板 prim)
    【面试】386- JavaScript 面试 20 个核心考点
    【Koa】385- koa框架的快速入门与使用
    【小程序】384- 如何一人五天开发完复杂小程序(前端必看)
    【React】383- React Fiber:深入理解 React reconciliation 算法
  • 原文地址:https://www.cnblogs.com/effortsing/p/10394400.html
Copyright © 2011-2022 走看看