KasparTr
KasparTr

Reputation: 2458

Deploying django app to production server, should I include environment (env) in git clone?

I have a working django app running on mý localhost. It is running inside a virtual environment.

No I want to deploy the same project into a Google Compute Engine. For that I have a question.

After I set up the production server including starting the virutal environment with vritualenv env do I need to clone in the project code from git including the env directory or only the source code including manage.py?

The process is described differently and so it is a bit confusing.

Main problem is the clarity of deploying the django app to production and the virtual environment setup using git for the code transfer.

Thank you for flow explanation.

My local structure is the following:

valuation     <-- project directory w/ manage.py
   valuation  <-- project w/ settings.py
     prophet  <-- app

In my production server I have the following structure

opt/valuation    <-- virtual environment
   valuation     <-- empty directory, [this][1] says I should clone code here 

My question is what should I clone from my local project and what do keep out (mainly the manage.py, settings.py etc) so that the project will run.

Thanks.

Upvotes: 0

Views: 655

Answers (1)

aman kumar
aman kumar

Reputation: 3156

no You don't need the clone the env folder, just make the requirements.text file , which will track all the plugins used in that project.You can update the requirements file using command

pip freeze > requirements.text 

on the server just create the new env and install all the plugins using below command

pip install -r requirements.text 

Upvotes: 2

Related Questions