On 4/05/2015 6:43 PM, João Marques wrote:
Oh I get it. I have a few questions:
1. Wheres should I configure my nginx?
/etc/nginx (probably)
This is part of my nginx config ...
location /static/ {
root /home/mike/envs/myproject/static;
access_log off;
log_not_found off;
}
location /robots.txt {
root /home/mike/envs/myproject/static/robots;
access_log off;
log_not_found off;
}
location /favicon.ico {
root /home/mike/envs/myproject/static/img;
access_log off;
log_not_found off;
}
2. Is there a any problem with my project folder structure? Because I do
have my templates outside the static folder...
Templates are not static files. They are part of Django's page rendering
mechanism. Static files are css, images and javascript plus other media
or files which don't need to be served *by* Django. You call such things
in your software by either naming them directly in your templates (like
css, js and images) or having variables in your templates which name
such static files.
Check the documentation starting at
https://docs.djangoproject.com/en/1.8/topics/templates/
I haven't had time to look at your project folder beyond noticing some
"interesting" folder names and files.
You should work through the tutorial (if you haven't already) and
discover the typical folder layout. It is easier to get the hang of
things if you stick with the conventional layout until you find a strong
reason to do things differently.
Good luck
Mike
├── costum
├── manage.py
├── psi
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── middlewares.py
│ ├── middlewares.pyc
│ ├── __pycache__
│ ├── settings.py
│ ├── settings.pyc
│ ├── urls.py
│ ├── urls.pyc
│ ├── wsgi.py
│ └── wsgi.pyc
├── static
│ ├── bower_components
│ ├── circle-progress.js
│ ├── css
│ ├── dist
│ └── js
├── static-root
├── templates
│ ├── admin-panel
│ ├── base.html
│ ├── home.html
│ ├── renderSolution.html
│ └── runAlgorithm.html
└── teste1
├── admin.py
├── admin.pyc
├── algorithm.py
├── binariesExchange.py
├── binaries.py
├── fitness.py
├── __init__.py
├── __init__.pyc
├── migrations
├── models.py
├── models.pyc
├── __pycache__
├── tests.py
└── views.py
On Monday, 4 May 2015 00:16:00 UTC+1, Mike Dewhirst wrote:
On 4/05/2015 6:08 AM, João Marques wrote:
> Now what happens when I run the server in "debug = False" is an
error
> 500. Without the "debug = False" I get this:'Empty static prefix not
> permitted'.
Googling that error brings up a few results. It seems to indicate a
problem with STATIC_ROOT and STATIC_URL when DEBUG is true and/or
misconfiguration of Nginx when DEBUG is false.
https://docs.djangoproject.com/en/1.8/howto/static-files/#deployment
<https://docs.djangoproject.com/en/1.8/howto/static-files/#deployment>
Running collectstatic drops all your static files into the STATIC_ROOT
directory on the server and that is where Nginx has to find them. The
way it works is that when a user requests a static file in a URL, Nginx
has to recognise the URL prefix to the static file named. The Nginx
config you need is to make the recognised URL prefix point to a real
location on the server (ie where collectstatic previously put the
static
files)
hth
Mike
--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/a7a5ded5-d804-4bcd-9327-ec1bd385707b%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/a7a5ded5-d804-4bcd-9327-ec1bd385707b%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/55475119.5040108%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.