On 17/10/2013 16:26, Tim Chase wrote:
How do folks prefer to layout their Django projects when using
virtualenv? Do you do either of the following, or something else?
Method 1: (project & apps at same level)
~/tmp$ virtualenv my_proj
~/tmp$ cd my_proj
~/tmp/my_proj$ . bin/activate
(my_proj)~/tmp/my_proj$ pip install django # ...
(my_proj)~/tmp/my_proj$ django-admin.py startproject my_project
(my_proj)~/tmp/my_proj$ django-admin.py startapp my_app1
(my_proj)~/tmp/my_proj$ # run/test from virtenv root
Method 2: (apps within project)
~/tmp$ virtualenv my_proj
~/tmp$ cd my_proj
~/tmp/my_proj$ . bin/activate
(my_proj)~/tmp/my_proj$ pip install django # ...
(my_proj)~/tmp/my_proj$ django-admin.py startproject my_project
(my_proj)~/tmp/my_proj$ cd my_project
(my_proj)~/tmp/my_proj/my_project$ ./manage.py startapp my_app1
(my_proj)~/tmp/my_proj/my_project$ # run/test from proj root
Do you have to jockey the $PYTHONPATH to find apps in either case?
If so, how do you make this portable/versioned (modify the
virtualenv scripts and add them to $VCS? have a custom script and put
that in $VCS?)
Which bits do you include/exclude when using version-control?
Do you keep your requirements.txt for pip at the top level virtualenv
directory, or inside the project folder (or elsewhere)?
I've seen a couple blog-posts that advocate "use virtualenv" but most
seem to elide the best-practice details.
Any tips appreciated.
-tkc
I'd keep the virtualenv directory and the project directory completely
separate.
Keep the requirements.txt file in the top level of your Django project
and use that if you ever need to regenerate your virtualenv directory
structure. Essentially the virtualenv environment should be completely
disposable since you can regenerate it automatically in the future if
required. You certainly shouldn't be committing it a version control
system. That seems rather messy to me.
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/52600284.8050304%40googlemail.com.
For more options, visit https://groups.google.com/groups/opt_out.