【发布时间】:2018-06-09 16:14:34
【问题描述】:
我正在开发 Django 1.11,网址,
http://djangoserver:8002/dj/dev/userlogin/789
适用于开发服务器,但使用 apache URL:
http://djangoserver/dj/dev/userlogin/789
它会抛出 Page not found (404) 错误。
用于 URL 的正则表达式是:
url(r'^[0-9]+$', views.userlogin.login , name='login'),
页面的重置显示正常。
我尝试了以下帖子中发布的解决方案,但对我不起作用: django application works on development server but I get 404 on Apache
working on django development server but not on apache
django production server: root path
我没有使用任何虚拟主机。我的 httpd.conf 文件代码 sn-p:
WSGIScriptAlias /dj /var/www/html/dev/dev/wsgi.py
WSGIDaemonProcess djangoserver python-path=/var/www/html/dev
WSGIProcessGroup djangoserver
WSGIScriptAlias /dj /var/www/html/dev/dev/wsgi.py process-group=djangoserver
<Directory /var/www/html/dev/dev >
# Options -Indexes +SymLinksIfOwnerMatch
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /static/ /var/www/html/dev/dev_app/static/
<Directory /var/www/html/dev/dev_app/static/ >
Require all granted
</Directory>
【问题讨论】:
-
如果您在此处发布您的 Apache 配置文件(至少是您正在使用的 VirtualHost 文件)可能会很有用
-
@jeasoft 我已经添加了代码 sn-p