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/
  • 相关阅读:
    解决VMWARE NAT SERVICE服务无法启动或服务消失的问题
    Struts2+Spring+Hibernate框架整合总结详细教程
    Hibernate框架搭建实例
    spring官网下载
    LVS(一)调度原理以及调度算法
    HyperText Transfer Protocol
    Nginx(三) Nginx负载均衡以及反向代理
    Nginx(二) Nginx主机配置、日志分割、日志自动备份
    Nginx(一) Nginx安装
    Oracle VM VirtualBox(一) 快速拷贝一个新的虚拟机
  • 原文地址:https://www.cnblogs.com/effortsing/p/10394400.html
Copyright © 2011-2022 走看看