Have you ever wondered how to easily change project name of your Django React stack?

I did.

Every time I start new project, I choose the first silly name, that comes to my mind.

But as time goes by, it can happen, that you completely change scope of the project and your project name become obsolete.

What was formerly known as “amazon_for_gardeners” could be “uber_for_craft_beer” next day.

In the early ages of the internet, you could easily rename your web project folder without any consequences.

But today, complexity of an average web app project grew thousandfold.

Before you can write a single line of code, you have to setup virtual environments, web frameworks, javascript compilers, CSS compilers, web servers, proxy servers, databases and git versioning.

It is no wonder, that something simple as renaming project folder can break your stack.

So I would like to share some tips on how I changed my Django React stack project folder name.

There are multiple caveats we have to keep in mind.

  • Django dependencies
  • React dependencies
  • Virtual environment dependencies
  • Database dependencies
  • File system dependencies
  • Git dependencies
  • Web server dependencies
  • Proxy server dependencies
  • Host configurations




Lets’s start with Django project structure.

You can safely rename your Django project folder and Django app folder like so.




Then rename some variables in settings.py, that is located at

ALLOWED_HOSTS = ['new_project_name.local', '']

ROOT_URLCONF = 'new_project_name.urls'

WSGI_APPLICATION = 'new_project_name.wsgi.application'

STATIC_ROOT = '/new_project_name/new_project_name/static/'

MEDIA_ROOT = '/new_projecT_name/new_project_name/static/images/'

In wsgi.py change following lines.

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'new_project_name.settings')

In manage.py apply new project name too.

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'new_project_name.settings')

If you have Celery package installed, then don’t forget to change celery.py too.

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'new_project_name.settings')

app = Celery('new_project_name’)


Gunicorn sever


Your Gunicorn sever needs treatment too.

In config file gunicorn.conf.py located at…



bind = "new_project_name.local:9010"

errorlog = '/new_project_name/new_project_name/logs/gunicorn-error.log'

accesslog = '/new_project_name/new_project_name/logs/gunicorn-access.log'


Nginx server


Find your Nginx conf file. On Mac, it is located at…


And change host variables to reflect your new project name.

server_name new_project_name.local;

access_log /new_project_name/new_project_name/logs/access.log;


proxy_pass http://new_project_name.local:9010;

root /new_project_name/new_project_name/;

Don’t forget to restart Nginx afterwards.

sudo brew services restart nginx


SQLite database


In Django database, find table named django_site and change values in both “name” and “domain” column.

Or use this handy update select.

update django_site set name = "new_project_name.local", domain = "new_project_name.local;


Local Host


Find the configuration file for your local hosts.

On Mac, it is located at…


There change your local host name variable.



Pipenv virtual environment


Previously, we renamed Django project folder, which is tightly tied to Pipenv virtual environment folder.

Unfortunately python virtual environments use hashed project folder name as a unique id.

Therefore we cannot simply rename virtual environment folder to reflect new project name.

If you try to run shell on new project name folder like so.

pipenv shell

Then Pipenv won’t recognise renamed virtual environment folder and will create new one with different unique hash.

New python virtual environment will lack any packages you have installed so far.

So reinstall all packages listed in pipfile with following command.

pipenv install


React and javascript stack


Lastly find package.json in your Django React stack.

Package.json is used for compiling your React code to static javascript file, that can be served by Django.

I have it located in my project here.


There change following variables…

"scripts": {
    "dev": "webpack --mode development ./new_project_name/react/src/index.js --output ./new_project_name/react/static/frontend/main.js",
    "build": "webpack --mode production ./new_project_name/react/src/index.js --output ./new_project_name/react/static/react/main.js",
    "flush": "pipenv run python ./new_project_name/manage.py flush --no-input"

Thats it!

Now everything should be fully functional and ready to go.

The only thing left is your Git repository.

But I have to still figure out how.


Update a day after: Renaming Git repository

So it turns out, that Git does not hold any references to project folder names. 

What I had to do was to go to Gitlab.com and in the settings, change project name and change Git repository url path.

Then if you are using Git GUI like GitKraken, just open new repo by choosing renamed project folder.


Hope this article helped you, so please share and comment if you liked it.

Seen you in the next post.

Share it!