博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
lnmp下django学习
阅读量:6876 次
发布时间:2019-06-26

本文共 3159 字,大约阅读时间需要 10 分钟。

 

[1]  安装一些软件包    .# install from EPEL[root@linuxprobe ~]# yum --enablerepo=epel -y install python-virtualenv[2]  在Virtualenv环境下安装Django,它可以为任何普通用户,这里使用root,建议使用普通用户。
#deactivate                # 退出当前虚拟环境#workon [虚拟环境名称]       # 使用某个虚拟环境#rmvirtualenv [虚拟环境名称] # 删除某个虚拟环境#lsvirtualenv              # 列出所有虚拟环境
[root@linuxprobe ~]$ virtualenv venv [root@linuxprobe ~]$ cd ~/venv [root@linuxprobe venv]$ source bin/activate (venv)[root@linuxprobe venv]$ pip install django Downloading/unpacking django Downloading Django-1.10.2.tar.gz (7.7MB): 7.7MB downloaded Running setup.py egg_info for package django no previously-included directories found matching 'django/contrib/admin/bin' warning: no previously-included files matching '__pycache__' found anywhere in distribution Installing collected packages: django Running setup.py install for django no previously-included directories found matching 'django/contrib/admin/bin' warning: no previously-included files matching '__pycache__' found anywhere in distribution changing mode of build/scripts-2.7/django-admin.py from 644 to 755 changing mode of /root/venv/bin/django-admin.py to 755 Installing django-admin script to /root/venv/bin Successfully installed django Cleaning up... # 上面的警告不是问题 (venv)[root@linuxprobe venv]# django-admin --version 1.10.2 # 退出virtualenv (venv)[root@linuxprobe venv]# deactivate
[3] 创建测试项目[root@linuxprobe ~]$ cd ~/venv [root@linuxprobe venv]$ source bin/activate# create "testproject"(venv)[root@linuxprobe venv]$ django-admin startproject testproject (venv)[root@linuxprobe venv]$ cd testproject # configure database (default is SQLite)(venv)[root@linuxprobe testproject]$ python manage.py migrateOperations to perform:  Apply all migrations: admin, auth, contenttypes, sessionsRunning 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 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 sessions.0001_initial... OK# create admin user(venv)[root@linuxprobe testproject]# python manage.py createsuperuserUsername (leave blank to use 'root'): rootEmail address: root@linuxprobe.orgPassword: Password (again): Superuser created successfully.# start server(venv)[root@linuxprobe testproject]# python manage.py runserver 0.0.0.0:8000Performing system checks...System check identified no issues (0 silenced).October 31, 2016 - 14:03:16Django version 1.10.2, using settings 'testproject.settings'Starting development server at http://0.0.0.0:8000/Quit the server with CONTROL-C. [4]从客户端计算机访问“http://(服务器的主机名或IP地址):8000 /”。如果以下网站正常显示,表示启动成功。

django学习推荐:http://www.cnblogs.com/feixuelove1009/p/5910384.html

 

转载于:https://www.cnblogs.com/hanlu5016/p/7872776.html

你可能感兴趣的文章
我的友情链接
查看>>
Java方法重载注意事项
查看>>
爱创课堂每日一题第五十九天- javascript继承的6种方法
查看>>
16.1 Tomcat介绍 16.2 安装jdk 16.3 安装Tomcat
查看>>
JS 正则表达式用法
查看>>
文档查看cat_more_less_head_tail
查看>>
python课堂笔记之django-day01(4)
查看>>
九月十九日作业
查看>>
Shell工作笔记01
查看>>
项目、软件开发过程中版本术语
查看>>
CSS实现背景透明,文字不透明(各浏览器兼容)
查看>>
【转】[大学引导]超级链接、字体颜色、音乐播放公式
查看>>
T-SQL中INSERT、UPDATE
查看>>
Linux下Nginx服务器配置Modsecurity实现Web应用防护系统
查看>>
linux下搭建 DNS 服务器
查看>>
实战Nginx与PHP(FastCGI)的安装、配置与优化
查看>>
列表去除重复的值
查看>>
CCNP学习之路之VLAN Hopping
查看>>
CentOS6.4内核升级, 2.6.*版本升级 Kernel 3.10.*
查看>>
8.27(文件权限管理 正则表达式)
查看>>