【发布时间】:2011-03-29 05:22:28
【问题描述】:
正如标题所描述的,Django 不断将我的 URL 从 /localhost/ 更改为 /127.0.0.1:8080/,这不断扰乱 Nginx 提供的静态文件。有什么想法为什么要这样做?谢谢!
/**编辑**/ 这里是 Nginx 配置:
server {
listen 80; ## listen for ipv4
listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name localhost;
access_log /var/log/nginx/localhost.access.log;
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)$
{
root /srv/www/testing;
}
location / {
proxy_pass http://127.0.0.1:8080/;
proxy_redirect off;
}
location /doc {
root /usr/share;
autoindex on;
allow 127.0.0.1;
deny all;
}
location /images {
root /usr/share;
autoindex on;
}
这里是 Apache 配置文件:
<VirtualHost *:8080>
ServerName testing
DocumentRoot /srv/www/testing
<Directory /srv/www/testing>
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias / /srv/www/testing/apache/django.wsgi
</VirtualHost>
【问题讨论】:
-
你是如何构建你的 URL 的?
标签: python django django-forms nginx