为了账号安全,请及时绑定邮箱和手机立即绑定

如何在手机上打开django网页

如何在手机上打开django网页

天涯尽头无女友 2018-10-10 12:33:57
查看完整描述

1 回答

?
慕莱坞森

TA贡献1810条经验 获得超4个赞

settings.py

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
)
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.admin',
    'django.contrib.staticfiles',
)

urls.py
from django.conf.urls.defaults import *
from django.contrib import admin
from django.conf import settings

admin.autodiscover()

urlpatterns = patterns('',
    url(r'^admin/', include(admin.site.urls)),
)

if settings.DEBUG:
    urlpatterns = patterns('',
        url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
        url(r'', include('django.contrib.staticfiles.urls')),
    ) + urlpatterns

查看完整回答
反对 回复 2018-10-24
  • 1 回答
  • 0 关注
  • 1200 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信