[英]Django Admin Page Unavailable in Apache
I believe I have all the prerequisites correct to get the admin page to appear, i have double checked with a bunch of other stack overflow posts and cannot figure out my error. 我相信我拥有正确的所有前提条件才能显示管理页面,我已经与一堆其他堆栈溢出帖子进行了双重检查,无法弄清我的错误。 Any help is greatly appreciated.
任何帮助是极大的赞赏。
So I have Django setup on my Apache server. 所以我在Apache服务器上安装了Django。 I go to
http://localhost/
and i get the IT WORKED! 我转到
http://localhost/
然后开始工作! Page. 页。 However, as SOON as I uncomment the admin lines in
settings.py
and urls.py
, I get the Django 404 Error. 但是,由于我很快就取消了
settings.py
和urls.py
的管理行注释,所以我收到了Django 404错误。 I think i am doing something wrong with the Aliases and links to the django admin folder. 我认为我在使用别名和指向django admin文件夹的链接时出现了问题。 Here is my relevant code
这是我的相关代码
httpd.conf (wsgi loadmodule is included) httpd.conf(包括wsgi loadmodule)
Alias /media/ "c:/xampp/htdocs/django_ngs/media"
Alias /static/ "c:/Python27/Lib/site-packages/django/contrib/admin/static"
<Directory c:/xampp/htdocs/django_ngs>
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias / "c:/xampp/htdocs/django_ngs/mod.wsgi"
settings.py (relevant parts) settings.py(相关部分)
ADMINS = (
# ('user', 'myemail@gmail.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'djangodb', # Or path to database file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': 'root',
'PASSWORD': '',
'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '', # Set to empty string for default.
}
}
MEDIA_ROOT = ''
MEDIA_URL = ''
STATIC_ROOT = ''
STATIC_URL = '/static/'
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
urls.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('',
url(r'^admin/', include(admin.site.urls)),
)
Any ideas? 有任何想法吗? Thanks in advance
提前致谢
For anyone also looking for a solution, I found the kink. 对于任何也在寻找解决方案的人,我发现了一个难题。 In urls.py it should have been
url(r'/admin/', include(admin.site.urls))
instead of url(r'^admin/', include(admin.site.urls))
, (switching the carrot for the forward slash). 在urls.py中,它应该是
url(r'/admin/', include(admin.site.urls))
而不是url(r'^admin/', include(admin.site.urls))
,(切换胡萝卜代表正斜线)。 This was not apparent in all of the other example url.py files I have looked at... Anyway thank you for your attention and attempt to help, i really appreciate your time. 在我查看过的所有其他示例url.py文件中,这并不明显。无论如何,感谢您的关注和帮助,我非常感谢您的宝贵时间。 Make sure the directory to your admin content is correct!
确保您的管理员内容目录正确!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.