Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix static resources loading #425

Closed
wants to merge 1 commit into from
Closed

Conversation

Mikiya83
Copy link

Align urls.py with autotest version

#424

Align urls.py with autotest version
@constantinius
Copy link
Member

Hi @Mikiya83

Thanks for the patch. I had to research myself, but in the back of my head there was something why this was not enabled. The reason is that this static file serving is only suitable for development, and not for production. This is the reason why it is not enabled in default instances.

The usual approach is to do a collectstatic and expose that directoy in your webserver (Apache, nginx, etc).
In the default docker images we use gunicorn, which does not provide a way to serve static files, so there it is still an unsolved issue.

@Mikiya83
Copy link
Author

Ok, indeed if gunicorn is not the "recommended" web server to use, this pull is not necessary, but it could be cool if the default docker image can use static files (without css files it's not very user-friendly ;) )

@constantinius
Copy link
Member

Indeed! Also, other parts like the web-client which rely on static files will not work at all. But using the static function in production seems to be discouraged by the Django devs.

Maybe we can add it behind the DEBUG flag like in this article?

if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

@Mikiya83
Copy link
Author

Why not, it's a good compromise to use DEBUG flag for that !

@constantinius
Copy link
Member

Superseded by #469

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants