Beginner question regarding virtualenv

62 views
Skip to first unread message

Leo

unread,
Jun 23, 2016, 2:38:45 PM6/23/16
to Django users

Hey Everyone,


I’m a total newb to using Django and open stack. I am working on creating a Django development environment in a VMware environment/Ubuntu OS. Eventually I want to deploy this to production.  The site’s purpose is as an intranet site.


I have been following the Django tutorial but recently discovered some other Django tutorials which led me to posting this question. I didn’t create a Python vitrualenv rather installed everything at the root of the OS. I am unsure if this will cause me problems or if I can proceed with this approach. I do not plan to use the VM for anything else but this specific intranet site.


Thanks for your help.

LV

Daniele Procida

unread,
Jun 23, 2016, 2:51:09 PM6/23/16
to Django Users
On Thu, Jun 23, 2016, Leo <lve...@gmail.com> wrote:

>I have been following the Django tutorial but recently discovered some
>other Django tutorials which led me to posting this question. I didn't
>create a Python vitrualenv rather installed everything at the root of the
>OS. I am unsure if this will cause me problems or if I can proceed with
>this approach. I do not plan to use the VM for anything else but this
>specific intranet site.

You'll probably get away with it! But, using virtualenvs really will make your life easier and happier as you continue.

Daniele

Gary Roach

unread,
Jun 23, 2016, 3:06:16 PM6/23/16
to django...@googlegroups.com
On 06/23/2016 11:36 AM, Leo wrote:
Hi Leo,

The only problem with not using virtuaenv in your case is if you are still periodically updating your software. Since you are using the OS versions of python and django you are at the mercy of those upgrades. A switch from Django 1.8 to 1.9 could break your project - as an example. A switch from Python 2.7 to 3.5 will definitely break you project.  Also how you set up depends on what IDE you are using. If you are just working with your standard command line monitor then the virtual environment is fairly straight forward. Use virtualevwrapper for python 2.7 but I would suggest pyvenv for python 3. There are very good docs for those on the web. If you are using an IDE, things could get more complicated. I'm using Eclipse with PyDev and had fits with the setup. I finally created a virtual environment in my /opt/ directory and, using pip, loaded it with Python3.5 and Django 1.9. I never really open the virtualenv but just point to it in the IDE setup. This seems to work so far.

In short, be safe and setup a virtual environment. It will make migration easier as well.

Gary R.

--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f2afd0a2-9644-4818-98d5-85bad724cae6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Leo

unread,
Jun 23, 2016, 3:38:36 PM6/23/16
to Django users
Gary and Daniele,

Looks like setting-up virtual environments is the way to go. Thanks for your help. I'm glad I asked before really digging in to serious development.

Leo

Mike Dewhirst

unread,
Jun 23, 2016, 7:25:33 PM6/23/16
to django...@googlegroups.com
On 24/06/2016 4:36 AM, Leo wrote:
> Hey Everyone,
>
>
> I’m a total newb to using Django and open stack. I am working on
> creating a Django development environment in a VMware environment/Ubuntu
> OS. Eventually I want to deploy this to production. The site’s
> purpose is as an intranet site.
>
>
> I have been following the Django tutorial but recently discovered some
> other Django tutorials which led me to posting this question. I didn’t
> create a Python vitrualenv rather installed everything at the root of
> the OS. I am unsure if this will cause me problems or if I can proceed
> with this approach. I do not plan to use the VM for anything else but
> this specific intranet site.

The whole reason virtual environments were invented was because it is
too expensive to use VMs in order to isolate your developments from each
other. If that VM won't be used for other projects you can postpone
using virtualenv until you want to work on more than one version of that
project or you want multiple projects with varying dependencies.


>
>
> Thanks for your help.
>
> LV
>
> --
> 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...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> <https://groups.google.com/d/msgid/django-users/f2afd0a2-9644-4818-98d5-85bad724cae6%40googlegroups.com?utm_medium=email&utm_source=footer>.

Tiglath Suriol

unread,
Jun 23, 2016, 10:23:01 PM6/23/16
to Django users

No problems necessarily.  You can have a machine-wide Python environment, and then separate isolated one in any number of virtualenv environments.  You keep track of which one you are using by chaning directory and activating virtualenv environments, or by getting out of them with 'deactivate'  It's your choice which one to use and why.

 

Nate Granatir

unread,
Jun 24, 2016, 10:45:27 AM6/24/16
to Django users
I've found that virtualenvs are definitely worth the time to set up, there will be a time down the road when you need to have two different versions of the same package. Also, I'd strongly recommend storing the project's dependencies in a requirements.txt file. I have a terrible memory and would never remember which versions are compatible with my project and which aren't.

As mentioned above, your IDE may help you set up and use virtualenvs. I use PyCharm and it can create the environment for you and associate that with your project.

Leo Vensel

unread,
Jun 25, 2016, 10:15:09 AM6/25/16
to django...@googlegroups.com
Great advice from everyone glad I asked. Project dependencies file definitely! Thanks

On Fri, Jun 24, 2016 at 10:45 AM, Nate Granatir <nategr...@gmail.com> wrote:
I've found that virtualenvs are definitely worth the time to set up, there will be a time down the road when you need to have two different versions of the same package. Also, I'd strongly recommend storing the project's dependencies in a requirements.txt file. I have a terrible memory and would never remember which versions are compatible with my project and which aren't.

As mentioned above, your IDE may help you set up and use virtualenvs. I use PyCharm and it can create the environment for you and associate that with your project.

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/mkVT60BLOAY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages