techgeek.biz being a geek is fun

[ Home ] [ Tech Tips ] [ Getting Started ] [ Contact ] [ About ]  
django remove admin from production how to

django remove admin from production how to 

Let's make your Django site more secure by removing your admin panel in production all together!

This is a great easy way to add secuirty to your site. This is obviously assuming you develop locally and then push it up to your production server

Step 1. In your settings.py add 

if (DEBUG == False):
    ADMIN_ENABLED = False
if (DEBUG == True):
    ADMIN_ENABLED = True

 

Step 2. now to your mainl urls.py where your main admin.site.urls is and remove it from the topline and replace it underneath

from django.conf import settings

if settings.ADMIN_ENABLED:
    urlpatterns += [
    path('admin/', admin.site.urls),
    ]

 

Done like a turkey

 

Luke Keam

Luke Keam

Thank you for reading.

Any questions, comments or suggestions
Email [email protected]

Have a great day from

Luke Keam 
techgeek.biz 
 

AD


                   

        

FOLLOW US

youtubemail

AD