Fork me on GitHub

django框架小技巧

带命名空间的URL名字

多应用中路由定义,采用命名空间,防止冲突

url(r'^polls/', include('polls.urls', namespace="polls"))

模板中url中采用如下方式,防止后续路由发生改变 <form action="{% url 'polls:vote' question.id %}" method="post">

打包自己的应用

http://python.usyiyi.cn/translate/django_182/intro/reusable-apps.html

Can not perform a '--user' install. User site-packages are not visible in this virtualenv. 因为我这用的是分离的python开发环境,所以不能用--user模式安装

posted @ 2017-07-09 21:34  迁梦余光  阅读(643)  评论(0编辑  收藏  举报