0

I have an application using Django1.9, and python2.7. I recently flushed my PostgreSQL database on my production server, and now whenever I try to use the application it is telling me there are missing modules. I never faced this issue before so I am curious, when you put your application on a production server, does your virtual environment go with it ? If so, does flushing your database have any effect on your virtual environment ?

I have been getting past the issues by downloading each module to a third parties directory in my application, and including them in my 'installed apps' list in my setting file, but I wouldn't want to continue doing that if there are 100+ modules I need to download.

I also tried to use pip install on my production server, and it said that the command was not found, although I have the latest version of pip installed on my mac ?

Levon
  • 138,105
  • 33
  • 200
  • 191
TJB
  • 3,706
  • 9
  • 51
  • 102

1 Answers1

1

I am curious, when you put your application on a production server, does your virtual environment go with it ?

Not necessarily unless you copied the virtualenv folder with it which isn't really a good practice, you should create the virtualenv on the production server

If so, does flushing your database have any effect on your virtual environment ?

No, the database and virtualenv are completely separate

I wouldn't want to continue doing that if there are 100+ modules

Use a requirements.txt file and install them all at one go with pip install -r requirements.txt

I also tried to use pip install on my production server, and it said that the command was not found

You have to install pip first, on the production server

Community
  • 1
  • 1
bakkal
  • 54,350
  • 12
  • 131
  • 107
  • how do you install pip on your production server ? I tried using sudo easy_install pip, and it asked me for a password for the application. Upon putting in the password, it gave me this error. "humanlink is not in the sudoers file. This incident will be reported." – TJB Jun 07 '16 at 21:23
  • Also, if you created a virtual environment on your production server, where would it live ? Would it be called site_packages like it normally does in your development application ? – TJB Jun 07 '16 at 21:25
  • @TimothyJosephBaney Hi there, the `sudo` stuff you have to check with your Linux and perhaps your sysadmin, basically you don't have the required privileges to `sudo`. You can put your virtualenv in any folder you want, then you activate it, doesn't have to be inside anything. Please look these up, maybe a tutorial to set these up in Linux. – bakkal Jun 07 '16 at 21:42
  • Awesome, thanks for the answers bakkal. I installed pip on the production server, so it is now way easier to install packages. I think there all linked to a single third party tool though, so hopefully it wont be that many. – TJB Jun 07 '16 at 22:01