0

I have an application that I'm developing on one server and running it on another. My question is about transferring this application to its destination server.

The application consist mainly of a large package with subpackages. There is also a small startup script, a sample config file and a systemd .service file. I have added setup.py and MANIFEST.in files to create a standard installable package.

This is my current workflow:

  1. on the development server:

    • do some work
    • git push it to a local repository
  2. on the production server:

    • activate an virtual env
    • pip install --upgrade git+http://...

It does the job, but recently I have read this: Where in a virtualenv does *my* code go?. I'm afraid that I'm probably doing it the wrong way.

In general I do agree with this answer (shortened):

 virtualenv provides a python interpreter instance, not an application instance. .... For example, you might have a project where you have multiple applications using the same virtualenv.

Now, I want to be able to share the same virtual env between applications. I'd like to change my workflow, but I don't know how.

I'm not even sure what are application files that should stay outside of a virtual env? My whole application or just everything except the python package, i.e the scripts and config files?

Or should I use the virtual env for requirement packages only, skip the pip and install my app with just git checkout?

Community
  • 1
  • 1
VPfB
  • 14,927
  • 6
  • 41
  • 75
  • 1
    Why don't you `pip freeze > requirements.txt`, and later in other instances of your application: `pip install -r requirements.txt`? This ensures that you have the same version every time you setup your application. (I might have missed your point, but on second reading this looks to me like the way to go) – maahl Feb 10 '16 at 14:53
  • @viod The point of my question (and my confusion as well) is that the application is supposed to be installed outside of a virtual env, but pip installs it inside the virtual environment. – VPfB Feb 11 '16 at 08:25

1 Answers1

0

In the meantime I've been looking for an answer to my question.

I think this was the prime cause of my misunderstanding: If a directory contains an __init.py__ file, it is a Python package. But that does not imply that it has to be listed as a package in setup.py.

VPfB
  • 14,927
  • 6
  • 41
  • 75