Recommended dev environment for a Django project deployed to Linode

332 views
Skip to first unread message

Jorge Arevalo

unread,
Sep 16, 2013, 1:33:49 PM9/16/13
to django...@googlegroups.com
Hello,

I'm going to start a project based on (Geo)Django + PostgreSQL/PostGIS + OpenLayers/LeafLet + Bootstrap/Foundation. The project will be deployed to a Linode box. That box will be created with something like this: https://manager.linode.com/linodes/deploy/linode393074?StackScriptID=6482

My work box is a MacBook with Mac OS X 10.6.8. There will be 2 people working on the web app (me and another guy). I have almost total freedom to choose, so I want to choose wisely. The whole point is that these constraints should be satisfied:

- I need a reliable way to upload the application to the test/production environments. At least the production environment will be a Linode box. I just don't want to upload files via FTP, or manually copy them with rsync, or any other practice easily subject to errors. How do the professional django developers set up their environment in order to deploy the app?

- I'm not sure about which IDE/editor choose. I don't want to start an editor war, and I've used several options in the past. My main interest is: I want to focus on develop. If Eclipse/Aptana/Eric/PyCharm/any IDE can be easily "linked" to my environment, that's my choice. For example, if I can deploy my app to test/production environment with a couple of clicks or commands, thanks to a plugin or script, that's great. Like deploying to Heroku or EC2, but with Linode. Is there any IDE specially friendly with this kind of development environment?

- The other(s) developer(s) must be up&running ASAP. They can't spend half a day installing and configuring stuff to start being productive. I guess a VirtualBox machine + Vagrant would be a good choice here. But, would it make more difficult the deployment cycle? And using a virtual machine to just open the IDE and develop sounds like a resource waste to me. Is there any other solution?

I think I should use, at least, VirtualEnv, VirtualEnvWrapper and PIP, like I've read in these useful links


But I'd like to know the opinion of Djanjo experts / hard "pythonistas". Any suggestion is strongly appreciated.

Many thanks in advance, and best regards

Jorge Arevalo

unread,
Sep 16, 2013, 1:44:13 PM9/16/13
to django...@googlegroups.com
Sorry, the first link (from linode) requires login. It was a link to the description of a StakScript that does this in a Linode box: 

"A Linode.com StackScript shell script that configures a complete web environment with Apache, PostgreSQL/MySQL/MongoDB, Python, mod_wsgi, virtualenv and Django.

Optionally creates a PostgreSQL/MySQL user and database and installs MongoDB NoSQL database.

By default, it creates a VirtualHost using the reverse DNS of your Linode's primary IP and sets up a sample Django project in the /srv directory.

Installs common system and dev utilities, sets up postfix loopback, Uncomplicated Firewall and Fail2Ban.

Writes command output to /root/stackscript.log and records /etc changes using etckeeper and git. When completed notifies via email.

This StackScript is a mashup of nigma's excellent system setup StackScripts (https://github.com/nigma/StackScripts) and a92bz53/steakknife's etckeeper StackScript (https://gist.github.com/steakknife/3452111)."
 

Vernon D. Cole

unread,
Sep 17, 2013, 9:50:55 AM9/17/13
to django...@googlegroups.com

I installed a client for my favourite distributed version control system on my Linode instance.  I have a private repository on a public IP.  (github, bitbucket, or launchpad will work, depending on your dvcs of choice -- I have used all three, and other times I have used a private dvcs host, including my Linode server itself.) I "cloned" a "checkout" of my django system to the Linode. When I am happy from testing a new version of my application:  I push it to the repository,  log in to my Linode using ssh, and do a pull.  Easy and error free.  (My django environment is almost exactly like yours with PostGIS, etc.)
--

Vernon D. Cole

unread,
Sep 17, 2013, 10:29:14 AM9/17/13
to django...@googlegroups.com
Answering the other half of your question:  The choice of IDE is not nearly as important as its ease of integration with your dvcs.  If you are already familiar with a good one, don't change.

On my present project, my boss and I are both using PyCharm, and my other co-worker is using Eclipse, since he is more comfortable (and therefore, more productive) with it. Both IDE's have good integration with git (my least favourite dvcs, but the boss's choice) and our sharing is done using a group private repository on github.  This is on Ubuntu Linux, it all works well.   In the evening hours, I use PyCharm on Windows 7 to contribute to an open source project hosted on bitbucket using mercurial. Both projects end up being tested on the same Linode.

Yes, use virtualenv.  I also made the mistake of thinking of it as a virtual computer.  It is not.  It is only a method of separating Python library directories so that you can experiment with different configurations easily.  It does not slow anything down, and actually makes installation of packages easier.  Use virtualenvwrapper to make switching environments easy.  PyCharm also supports virtual environments as well as django projects. It is commercial, and suffers from a few Java idiosyncrasies, but the boss paid for the license ;-) so I don't mind.

Jorge Arevalo

unread,
Sep 25, 2013, 2:01:36 PM9/25/13
to django...@googlegroups.com
Hello,

First of all, many thanks for your response. Sorry for the delay answering this. I was in a business trip. 

So, you basically have 2 environments: your own machine, and the Linode box. You make the development and testing in your machine, and Linode is for production purposes. And you connect both environments via dvcs push/pull. Right?

I like it because it's simple and doesn't seem to be specially prone to errors. I'd just like to add a third scenario here, to end up with:

- Development environment: my own machine (Mac OS X) with all the software stack installed.
- Testing environment: my new addition. I would like to put this environment outside of my machine
- Production environment: the Linode box.

I can do the communication via push/pull, if there's no other way to "deploy" software to production with Python/Django (it's simple, I like it). And maybe I can have 2 urls (testing and production) in the Linode box. Testing just accessible to developers and testers, and production open to normal users. Does it make sense?

Thanks again

Jorge Arevalo

unread,
Sep 25, 2013, 2:06:55 PM9/25/13
to django...@googlegroups.com
Fine. I don't think my boss is going to pay for PyCharm license, so I'll probably go for Eclipse now (I don't really like it too much, but if works, it's ok for me)

About virtualenv, is there any method to provide something like a script to create a virtualenv, install the needed software and have a working environment in a few commands? Something like "vagrantfile for virtualenv" http://docs.vagrantup.com/v2/vagrantfile/index.html

Again, many thanks for your useful insights

Bill Freeman

unread,
Sep 25, 2013, 2:49:34 PM9/25/13
to django-users
I guess that it's what you're used to.  I'm perfectly happy with emacs (less so with vi or vim, but still happy enough).  I'm happy with emac's python mode, css mode, etc.  There's even supposed to be help for Django templates now.  I'm using the Espresso add-on for JavaScript.  It's not everything that the IDEs offer, but I don't have to keep re-learning how to do things.  vim has some pretty good syntax support too.  I certainly wouldn't pay for something.  And having installed eclipse, it makes emacs look light weight.

Indeed, I, too, tend to develop and test on my laptop, when I'm happy, check in my chaanges (mercurial), push to the linode, ssh in, update to head, and touch the wsgi script file (IIRC).  In a pinch I can directly edit on the linode, using vim through ssh, or emacs tramp mode over ssh, or, if you want to install your favorite X based editor on the linode, through a ssh -Y tunnel.

Bill, the curmudgeon


--
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

Vernon D. Cole

unread,
Sep 25, 2013, 3:48:26 PM9/25/13
to django...@googlegroups.com
Yes, I like to have three levels, too.  I call the middle one "staging".  You can tear it down and build it up again as many times as needed to get it right.

A ten-year-old PC will work fine for staging practice. Blow the dust out (the dust affects cooling and leads to poor reliability), load Ubuntu, and park it in an unused corner somewhere.  My home-office Linux box is a Dell desktop purchased at a University surplus sale for $20 six or seven years ago. It runs Apache, MySQL, Asterisk, and the Python program that regulates the lights and heat in our Iguana enclosure. The most expensive component (other than the iguana) is a $50 UPS.  Much easier than trying to make your production machine do double duty.

I use a structured settings module to switch back-and-forth between the three levels.  Look at the manage.py and the formhub/settings directory in https://github.com/vernondcole/formhub for an example how to do that.   Also look at requirements.pip in that repository for an idea how to load most of the prerequisites automatically. Documentation is in the wiki of https://github.com/modilabs/formhub/wiki/_pages .  (Formhub is a django system used to receive generic survey data taken using android devices offline.)




--
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/QhYZZF7mrIw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.

Roberto López López

unread,
Sep 25, 2013, 4:59:52 PM9/25/13
to django...@googlegroups.com
--
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


-- 

Roberto López López
System Developer
Parallab, Uni Computing
+47 55584091

Cal Leeming [Simplicity Media Ltd]

unread,
Sep 25, 2013, 7:13:58 PM9/25/13
to django...@googlegroups.com
+1 for virtualenvwrapper, don't know how I survived without this!!

Cal

Christiano Anderson

unread,
Sep 26, 2013, 7:36:21 AM9/26/13
to django...@googlegroups.com
I have the same stack, GeoDjango + PostGIS (and all its dependencies like GDAL, Proj, GEOS, etc). My notebook runs Debian (also I have a Mac Book Pro, but I prefer to work on Linux) and I use Digital Ocean to host my projects, also running Debian boxes. Since Debian keeps an older version of PostGIS, I have created my own .deb package of PostGIS 2.1.

IMHO VirtualEnv and VirtualEnvWrapper is the best way to keep your environment updated with the same versions. I also keep a requirements.txt file into the project (I use Git and Bitbucket) with the output of pip freeze command. 

best regards,


--
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

Ezequiel

unread,
Sep 26, 2013, 1:54:55 PM9/26/13
to django...@googlegroups.com
On Wednesday, September 25, 2013 3:06:55 PM UTC-3, Jorge Arevalo wrote:
Fine. I don't think my boss is going to pay for PyCharm license, so I'll probably go for Eclipse now (I don't really like it too much, but if works, it's ok for me)

PyCharm, which is my favorite IDE, has now a Free Community Edition: https://twitter.com/pycharm/status/382549991165673472

Best,

Jorge Arevalo

unread,
Oct 9, 2013, 8:05:41 AM10/9/13
to django...@googlegroups.com
Thanks both for the suggestions! (and sorry for the delay, I was on a business trip). Looks like there's a lot of things to learn. I'll probably use a staging machine, like suggested. And now I'm between Eclipse, emacs and PyCharm. Time to work!

Jorge Arevalo

unread,
Oct 9, 2013, 8:06:22 AM10/9/13
to django...@googlegroups.com
Tested. Works great. Thanks a lot!

Jorge Arevalo

unread,
Oct 9, 2013, 8:07:32 AM10/9/13
to django...@googlegroups.com
Yep. VirtualEnvWrapper looks like a winner. And thanks for the suggestion about the requirements.txt

Jorge Arevalo

unread,
Oct 9, 2013, 8:08:04 AM10/9/13
to django...@googlegroups.com
Interesting! I'm downloading it. Many thanks!
Reply all
Reply to author
Forward
0 new messages