views:

136

answers:

2

I need advice if this setup is ok. I have a personal dev server which runs Ubuntu. I have setup Ubuntu completely with git, django, mod_wsgi and apache2 running. I will be developing using my Macbook Pro.

My idea was to have identical directory structure on both machines off of web root.

Say:

Mac: /path/to/webroot/
                      ...project1/
                      ...project2/

Ubu: /home/me/webroot/
                      ...project1/
                      ...project2/

And use git to initiate the repo on Ubu server and clone it on my mac and start developing. This way I will achieve:

  1. Multiple code instances. So that if Ubuntu crashes, I have the code on Mac
  2. I will have the code locally on my Mac and that will help if I am on the move.

Please advice if this is a good thinking or needs any improvement.

+1  A: 

Sounds OK to me.

Multiple code instances. So that if Ubuntu crashes, I have the code on Mac

If you want to be extra paranoid (like I am) you should think of a third place where your code is available. A git solution like github plus something like Dropbox might be worth pondering.

Manoj Govindan
Go with github (for git), bitbucket (Mercurial) or beanstalk (svn). Dropbox is awesome, but wasn't built for source code version control
stevejalim
@stevejalim: I use both github and Dropbox. All my static, non version controlled assets as well as (temporarily) shared project documents go into a Dropbox folder.
Manoj Govindan
Thanks. I have a question: Is it a good idea that my macbook pro should also have a setup of apache+mod_wsgi+django that enables me to run the same code on my macbook? If yes, then do I need to install a fresh copy of Apache on Macbook or is it ok to have something like XAMPP+mod_wsgi?
AJ
I think it should and XAMPP should be fine. I'd just have to install my mod_wsgi with XAMPPs Apache. Sweet!
AJ
+1  A: 

If your using Django, why bother installing Apache. Django comes with an excellent dev environment. I just use: manage.py runserver

You achieve your 2 points, by just having git clones on the server and on your laptop for work. No need for Apache.

Two notes:

  1. Since I ran into a bug that occurred on MySQL, but didn't on sqlite, I test projects on the same dbbackend before deploying. But for development on the laptop, all I need is Python, Django and sqlite.

  2. I try to use the same Python as on the deployment server. I've deployed on "Enterprise" distro's which means ancient ("stable") versions, that miss new features. virtualenv helps keeping things seperated.

These two can be solved by just adding an extra 'test' deployment of your project on the server for a last testrun on the same platform just before your updates.

PS: If you don't mind installing and configuring the extra software why not go all out and install an Ubuntu VM in a virtualbox. You could even make your main server a VM and every now and then take a snapshot of the image on the road...

edit: runserver will listen on port 8000 on localhost. If you want to connect to it from other hosts use manage.py runserver 0.0.0.0:8000 to listen on 8000 on all ip-addresser or, if you're worried on leaking info to snoopers, use ssh -L8000:127.0.0.1:8000 <ubuntu-server> to tunnel 8000 on localhost (your client) to 8000 on localhost (your server) through ssh. Whichever fits your needs.

CharString
`manage.py runserver` I tried this command on Ubuntu server I have but I could not access the python's dev server by <ubuntu ip address>:8000 for some reason. if port is different, there should not be any conflict. Hence, I decided to go to Apache.
AJ
I like the virtualEnv idea. Although, I do not want Virtual Machines running on my Macbook. I do have VMWare but I hardly use it. I feel that it speeds up the death of my hard drive. lol
AJ
Virtualenv is not just great for mimicking deployment environment on your dev-machine, it can help when you might have different projects that use different versions of apps and have different module dependencies.
CharString