Closed mrwert closed 9 years ago
Hey @mrwert, is this locally or via a webserver such as Nginx or Apache? If you can let me know I'll be able to give you some more specifics on how to resolve this issue.
Is this locally...
If you're launching it from console.py (using ./console.py dev runserver
) then make sure that your console.py contains the following:
SCRIPT_DIR, SCRIPT_FILE = os.path.split(os.path.abspath(__file__))
os.environ.update({
'APP_MODULE': 'YOUR_MODULE',
'APP_DIR': os.path.join(SCRIPT_DIR, 'YOUR_MODULE'),
'PUBLIC_DIR': os.path.join(SCRIPT_DIR, 'public'),
'SCRIPT_DIR': SCRIPT_DIR
})
It will then attempt to server any static files in /public first prior to running any Python code (as PUBLIC_DIR is set to reference 'public'). The general structure I stick to is this:
app/
.. backend source here
public/
css/
img/
js/
:+1:
hi, i have a problem in load public file return 404 error after run server from console.py
Hello! I have a problem:
---------------[ /config/routes.py ]--------------- routes = { 'example': { 'path': '/example/:id', 'options': {'controller': 'index.controllers.example'} } 'example2': { 'path': '/example2', 'options': {'controller': 'index.controllers.example2'} } }
---------------[ http://..../example2 ]--------------- "GET /example2 HTTP/1.1" 200 "GET /img/map.png HTTP/1.1" 200 "GET /css/base.css HTTP/1.1" 200
---------------[ http://..../example/blabla ]--------------- "GET /example/blabla HTTP/1.1" 200 but: "GET /example/img/map.png HTTP/1.1" 404 "GET /example/css/base.css HTTP/1.1" 404
How can i to get static files from public/* ? Thanks.