I’m trying to get a handle on this, but it’s not working. I don’t see any of the documentation explaining the stuff I do not understand. Everything I’ve read explains how to get Django working under different environments. I can do that. What none if it explains is how to PORT a Django app from a development server to a production server. So I’ll try and make my question as clear as possible.
Suppose I have a development server, and I do the following:
Create a virtual environment:
virtualenv env1
Activate the venv:
source env1/bin/activate
Install Django:
pip3 install django
and all the MySQL stuff:
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential pkg-config
sudo apt install libffi-dev
pip install mysqlclient
I start a Django project:
`` django-admin startproject testproject
1
.
Alter my settings.py as necessary.
Then I test it:
python manage.py runserver
X.X.X.X
:8000
and all is well with my test project.
Now on to the production server. I install and configure Apache, set up my database.
Then:
Create a virtual environment:
virtualenv env2
Activate the venv:
source env2/bin/activate
Install Django:
pip3 install django
and all the MySQL stuff:
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential pkg-config
sudo apt install libffi-dev
pip install mysqlclient
I start a Django project:
`` django-admin startproject testproject
2
.
Alter my settings.py as necessary.
If I configure the apache files properly, it will serve my Django project. That’s all fine. And that brings us to where I’m stuck. What do I do now to port my testproject1 to the Apache server? It cannot be as simple as copying the testproject1 directory over, can it? What are the steps here? If the documentation explains it, I’ve missed it. Please elaborate.