How to change project name on Django
Hello, welcome to the devmaesters website. In this post I am going to show you how you can easily change the name of your Django project without any errors.
So please follow the steps here and if there are any questions then feel free to leave a comment down below.
Step 1
Go to your project's wsgi.py file and change the project name to the one you want
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'oldname.settings')#change old name here
application = get_wsgi_application()
app = application
to
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'newname.settings')
application = get_wsgi_application()
app = application
Step 2
Go to your project's asgi.py file and change the project name to the one you want
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'oldname.settings')#change old name here
application = get_asgi_application()
to
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'newname.settings')
application = get_asgi_application()
Step 3
Go to your settings.py file and edit the project names in the following settings to the new one you want
ROOT_URLCONF = 'oldname.urls'
WSGI_APPLICATION = 'oldname.wsgi.application'
to
ROOT_URLCONF = 'newname.urls'
WSGI_APPLICATION = 'newname.wsgi.application'
Step 4
Finally go to your manage.py file and edit the project name
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'oldname.settings')
to
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'newname.settings')