我是 Django 和 Python 的新手。我只做过php。
我尝试了三遍,但我几乎已经正确安装了 Django。我按照教程安装它,它工作。所以我启用了管理员、面板并设置了 mysql。
管理面板工作,我有我的静态文件夹,所以它也有所有的 css。但是当我进入主页时,我得到了这个 404。(我的项目称为firstweb)所以当我进入 firstweb 有一个 404,但 firstweb/admin 工作。
Using the URLconf defined in firstweb.urls, Django tried these URL patterns, in this order:
1. ^admin/
The current URL, firstweb/, didn't match any of these.
我对整个 runserver 的事情感到困惑。那是不是我的 Apache 以外的其他小服务器?为什么我每次都需要启动它?
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'firstweb.views.home', name='home'),
# url(r'^firstweb/', include('firstweb.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
)