Open rejozenger opened 11 years ago
Okay, just for the record:
newspeak runserver
)When talking to the Django directly:
rejo@trillian:~$ telnet localhost.localdomain 8000
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
GET /admin/ HTTP/1.1
HTTP/1.1 200 OK
Server: gunicorn/0.17.2
[...]
<link rel="stylesheet" type="text/css" href="/_static/admin/css/base.css" />
<link rel="stylesheet" type="text/css" href="/_static/admin/css/login.css" />
[...]
And:
rejo@trillian:~$ telnet localhost.localdomain 8000
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
GET /_static/admin/css/base.css HTTP/1.1
HTTP/1.1 200 OK
Server: gunicorn/0.17.2
Date: Mon, 18 Feb 2013 16:21:36 GMT
Connection: close
Last-Modified: Mon, 21 Jan 2013 21:27:17 GMT
Content-Length: 14065
Content-Type: text/css
[...]
So, that works. This is with STATIC_URL unset in the configuration.
In front of this server, I have nginx running. It has the following configuration:
location ^~ /ns2/ {
rewrite /ns2/(.*) /$1 break;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8000/;
proxy_redirect http://127.0.0.1:8000/ /ns2/;
}
As for your last question, that takes some more time and I'll get back to you tomorrow or the day after.
So summarizing:
http://127.0.0.1:8000/_static/<some_static_resource>
returns a 200.http://<nginx_server>/ns2/<some_dynamic_resource>
proxies the request to http://127.0.0.1:8000/<some_resource>/
and returns a 200 as well.STATIC_URL = '/ns2/_static/'
generates URL's for static resources of the following form http://<nginx_server>/ns2/_static/<some_static_resource>
, generating a 404.This means that either 1-4 is not correct or that:
The most likely situation here seems to be that STATIC_URL
was improperly set (i.e. the settings was never made active by restarting Django). Please provide some feedback.
When attempting to serve the webpages from a subdirectory (https://example.com/ns2/ instead of https://example.com), the links to the CSS and other related files are returning a 404. This is probably just a matter of properly configuring Django.
When I do not configure STATIC_URL the following is generated in the admin/ page where one is asked to login:
These do not work and will return a 404. Manually prepending the name of the subdirectory make these valid URL's.
When I add the following:
STATIC_URL = '/ns2/static/'
the following code will be generated:
These will return a 404.
When adding:
STATIC_URL = '/ns2/_static/'
The following will be returned:
These will generate a 404 as well (and please note: these were working when STATIC_URL was not set).