Question
Asked By – Phillip B Oldham
What sort of directory structure should one follow when using virtualenv
? For instance, if I were building a WSGI application and created a virtualenv called foobar
I would start with a directory structure like:
/foobar
/bin
{activate, activate.py, easy_install, python}
/include
{python2.6/...}
/lib
{python2.6/...}
Once this environment is created, where would one place their own:
- python files?
- static files (images/etc)?
- “custom” packages, such as those available online but not found in the cheese-shop?
in relation to the virtualenv
directories?
(Assume I already know where the virtualenv directories themselves should go.)
Now we will see solution for issue: Where in a virtualenv does the custom code go?
Answer
virtualenv
provides a python interpreter instance, not an application instance. You wouldn’t normally create your application files within the directories containing a system’s default Python, likewise there’s no requirement to locate your application within a virtualenv directory.
For example, you might have a project where you have multiple applications using the same virtualenv. Or, you may be testing an application with a virtualenv that will later be deployed with a system Python. Or, you may be packaging up a standalone app where it might make sense to have the virtualenv directory located somewhere within the app directory itself.
So, in general, I don’t think there is one right answer to the question. And, a good thing about virtualenv
is that it supports many different use cases: there doesn’t need to be one right way.
This question is answered By – Ned Deily
This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0