setup django 4 test
2016-05-02 11:29
489 查看
install
create and switch to user
check the django information
project part
app part
步骤:
1.< project >/setting.py/INSTALLED_APPS 添加app的名字
2.< project >/urls.py/urlpatterns 增加
3.< app >/urls.py/urlpatterns 增加
4.< app >/views.py 添加
5.< app >/templates/< app >/ 里添加index.html等模版
6.< project >/setting.py/TEMPLATES.’DIRS’ 中添加
7.< app >/static/< app >/style.css
8.图片放置:< app >/static/< app >/< images >/xxx.png
emerge dev-python/pip pip install django
create and switch to user
useradd django su django
check the django information
python -c 'import django; print(django.get_version())'
project part
django-admin startproject mysite cd mysite python manage.py migrate python manage.py runserver 0.0.0.0:8000
app part
python manage.py startapp polls
步骤:
1.< project >/setting.py/INSTALLED_APPS 添加app的名字
2.< project >/urls.py/urlpatterns 增加
url(r'^admin/', include(admin.site.urls))
3.< app >/urls.py/urlpatterns 增加
url(r'^$', views.index, name='index')
4.< app >/views.py 添加
def index(request): return HttpResponse('main')
5.< app >/templates/< app >/ 里添加index.html等模版
6.< project >/setting.py/TEMPLATES.’DIRS’ 中添加
os.path.join(BASE_DIR, 'templates')
7.< app >/static/< app >/style.css
li a { color: green; }
8.图片放置:< app >/static/< app >/< images >/xxx.png
相关文章推荐
- DragonBoard 410c手把手进行安卓开发之底层移植
- 机器学习系列(8)_读《Nature》论文,看AlphaGo养成
- Mapreduce Patterns, Algorithms, and use cases
- django快速搭建简单blog
- django1.8读书笔记模型高级进阶
- Google机器学习教程心得(二)决策树与可视化
- Google机器学习教程心得(二)决策树与可视化
- Ubuntu上用mod_wsgi部署Django出现的一些问题
- Django 的 CSRF 保护机制
- Google Code Jam 2016 Round 1B Problem C. Technobabble
- 彻底消除wine中文乱码,QQ,kugoo等等....
- AET在多边形扫描转换中的使用 Scan conversion polygon and fill red color inside
- Google机器学习教程心得(一)
- Google机器学习教程心得(一)
- 如何上传应用到 Google Play
- 【SPOJ-GONE】G-One Numbers【数位DP】【记忆化搜索】【质数筛】
- go语言结构体
- Got a packet bigger than ‘max_allowed_packet’ bytes的解决方法
- 如何使用robots不让百度和google收录
- 如何使用robots不让百度和google收录