我正在尝试为我正在创建的项目运行 /admin。我在这里面临两个问题
1.当我将浏览器指向 127.0.0.1/admin/ 它说找不到页面但是当我将浏览器指向 127.0.0.1 然后我得到我的项目文件中的文件列表如何纠正这个
2.每次我重新启动apache都没有创建pyc文件??
-rwxrwxrwx 1 root root 546 2012-07-11 15:45 manage.py
-rwxrwxrwx 1 root root 0 2012-07-12 17:53 __init__.py
-rwxrwxrwx 1 root root 34 2012-07-12 18:03 test
-rw-r--r-- 1 root root 114 2012-07-12 18:03 __init__.pyc
drwxr-xr-x 2 root root 4096 2012-07-12 18:20 tmp
-rwxrwxrwx 1 root root 4489 2012-07-12 18:20 settings.py
-rwxrwxrwx 1 root root 585 2012-07-12 18:34 urls.py
我已django.contrib.admin
在 settings.py 文件中包含已安装的应用程序,这也是下面的 urls.py 文件
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'^$', '{{ project_name }}.views.home', name='home'),
# url(r'^{{ project_name }}/', include('{{ project_name }}.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))
)
EDIT
我还没有创建任何模块..我应该创建一个模块然后访问管理员吗?
EDIT1
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
# This application object is used by the development server
# as well as any WSGI server configured to use this file.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
/etc/apache2/httpd.conf
WSGIScriptAlias / /opt/mysite/wsgi.py
WSGIPythonPath /opt/mysite
<Directory /opt/mysite>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>