Sunday, January 5, 2014

Re: django 1.4 : gunicorn can't find static files. settings option

Hi, 

if you don't have a web server available (for example on some PaaS like Heroku), you can do two things for production-ready static file serving: 

- use an external service like Amazon S3 (with the help of django-storages)
- use dj-static, which uses an WSGI middleware to serve your static files and integrates into django (alternative is SharedDataMiddlware of werkzeug, used by flask)

Don't forget that you have to run „./mange.py collectstatic" to gather all the files in one directory. 

Am 05.01.2014 um 10:10 schrieb Mahdi Mazaheri <me.mazaheri@gmail.com>:

Hi Huseyin,

I have the same problem as Bo but this again did not solve my problem. This works with django webserver (runserver) but not with gunicorn.
Any Ideas?

Thanks in advance
Mahdi

On Wednesday, May 16, 2012 10:38:39 AM UTC+4:30, huseyin yilmaz wrote:
For development, you could add this to main urls.py like this.
    (r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.STATIC_ROOT, 'show_indexes':True}),

But for production use your web server to serve static files.

At least this is how I solved it. I hope that helps.

On May 16, 5:56 am, Bolang <boo.l...@gmail.com> wrote:
> Hi,
> I just started to using django 1.4 with gunicorn 0.14.3
> With ./manage.py runserver , i can start django properly and django can
> find my files in static directory.
> Then i use gunicorn and then gunicorn can't find my files in static
> directory.
>
> I have tried these combination
> gunicorn myproject.wsgi:application --settings myproject.settings
> gunicorn myproject.wsgi:application --settings /absolute/path/to/settings.py
> ./manage.py run_gunicorn --settings=myproject.settings
>
> All of the commands can start django, but can't find my files in static
> directory
>
> I also found this issuehttps://github.com/benoitc/gunicorn/issues/322
> But, i can't find the solution from that page.
>
> Any kind of help will be appreciated
>
> Thanks

--
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+unsubscribe@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/6e99aaf4-44e9-4fff-8ada-d5fc96e55d7b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



-- 
Freundliche Grüße

Denis Cornehl
Simon-Dach-Str. 7 / 10245 Berlin

M: +49 (151) 25 25 1450
@: denis.cornehl@gmail.com

X: http://xing.to/dc

No comments:

Post a Comment