I am currently working in a Django project for which I need access to the admin area for local development, but want to disable it in the deployed site (for security reasons, among others).
How can I achieve this programmatically (ie using settings.py).
Many thanks.
First, establish a scheme so that your production server can have different settings than your development servers. A simple way to do that is with a source-control-ignored local_settings.py file, but there are many fancier ways to do it.
Then, in your settings.py file, put:
and in your production-only settings file, put:
Then in your urls.py: