Serve static files in production server

65 views
Skip to first unread message

Stefano Tranquillini

unread,
Dec 30, 2012, 7:27:12 AM12/30/12
to django...@googlegroups.com
Hi all.
in the appfog ML we were fighting again the possibility to serve static file in django without using an external server.
So far AF does not provide a setup of the server to split the server in static and dynamic (django) folders.
so, one of the solution is to use this

# urls.py 
urlpatterns += patterns('', 
url(r'^static/(?P<path>.*)$', 'django.views.static.serve', { 
'document_root': settings.STATIC_ROOT}) 
)

but, is it ok to use this trick in django or will it lead to problems (aka memory problems and stuff like that)?

ciao

--
Stefano

Amirouche

unread,
Dec 30, 2012, 12:01:24 PM12/30/12
to django...@googlegroups.com
Héllo Stefano,
The documentation state «Again, this view is not hardened for production use» [1]

What is the particular issue your are facing ? Maybe tproxy [2] can help.

Regards,

Amirouche

Stefano Tranquillini

unread,
Jan 2, 2013, 10:57:00 AM1/2/13
to django...@googlegroups.com


On Sunday, December 30, 2012 6:01:24 PM UTC+1, Amirouche wrote:
Héllo Stefano,

On Sunday, December 30, 2012 1:27:12 PM UTC+1, Stefano Tranquillini wrote:
Hi all.
in the appfog ML we were fighting again the possibility to serve static file in django without using an external server.
So far AF does not provide a setup of the server to split the server in static and dynamic (django) folders.
so, one of the solution is to use this

# urls.py 
urlpatterns += patterns('', 
url(r'^static/(?P<path>.*)$', 'django.views.static.serve', { 
'document_root': settings.STATIC_ROOT}) 
)

but, is it ok to use this trick in django or will it lead to problems (aka memory problems and stuff like that)?

The documentation state «Again, this view is not hardened for production use» [1]

What is the particular issue your are facing ? Maybe tproxy [2] can help.

the problem is that the appfog server does not provide a way to set up static part. so for convenience i (we) tried to use a workaround for solving the problem.

ciao
Reply all
Reply to author
Forward
0 new messages