I've been working with Django for a while, and it helped me to get all my web developments with nice urls. But I also wanted a nice url structure...
What it is nice for me, opposite to Django default settings, is avoiding the media prefix on my media urls, so
http://localhost/media/admin/css/login.css would be http://localhost/admin/css/login.cssTrying to emulate old website structures (used widely in php sites).
That could be nice or not, but for sure it is complicated.
The first step was to setup apache for it, a little bit more complicated than the usual setup, but possible:
SetHandler None
The main problem comes when using Django development http server (started by "python manage.py runserver"), and the admin. Of course you can do that, but what is not possible, is to define the same name for your admin media path, and for the admin itself.
For example:
http://localhost/admin and http://localhost/admin/css/login.css
The reason is the Django web server, processes all requests starting with the ADMIN_MEDIA_PREFIX setting with the AdminMediaHandler, what implies with that structure that all admin requests (even the ones that aren't static files) are processed by this handler, raising an error when the request isn't for a static file. The error is next.
Permission denied: ${PYTHON_PATH}/django/contrib/admin/media/
So this is my resignation statement to do what I wanted to do initially. Now, options are:
-
NOTE: Current version of my project DSNP is affected by this issue. I'll solve it asap.