background preloader

Django

Facebook Twitter

Philip O'Toole - Vallified » My guidelines for reusable Django applications. I came to Django development from much lower-level development — embedded software, device drivers, and system software.

Philip O'Toole - Vallified » My guidelines for reusable Django applications

What has impressed me most about Django (and python in general) is the manner in which it guides you to do the right thing in terms of code construction. The framework and language naturally make you think about better ways to express your designs. What took me a little longer to understand was the power of Django applications (apps for short). While the advantages of modular code are well known, how my own Django apps could be truly modular was not immediately apparent. But now I have some guidelines, thanks to personal experience. Reduce the requirements of your applications to a minimum I first came across James Bennett’s excellent video about reusable Django apps early in my work with the web framework. For example, we needed an app which created and controlled resources in an external system. Testing, testing, testing An example might help to illustrate this point. Using mod_wsgi to Serve Applications on Ubuntu 12.04.

Prerequisites Before starting on this article, be sure that you have gone through the previous 2 in this series.

Using mod_wsgi to Serve Applications on Ubuntu 12.04

You can find them here: Installing Django on Ubuntu 12.04 Installing mod_wsgi on Ubuntu 12.04 Creating the Django Application: First of all, we will navigate to the home directory. Create a new directory and switch into it: mkdir -p ~/public_html/domain1.com cd ~/public_html/domain1.com After that, go ahead and create a project with the help of the django-admin.py tool. django-admin.py startproject MyTestProject Creating the Virtual host & WSGI file: To serve a Django app properly, it is important for Apache to know that it is supposed to forward certain types of requests to mod_wsgi. Sudo nano /etc/apache2/sites-available/domain1.com Next, enter below definition for the virtual host: <VirtualHost *:80> ServerName domain1.com ServerAlias www.domain1.com WSGIScriptAlias / /home/username/public_html/domain1.com/MyTestProject.wsgi </VirtualHost> Type in the following configuration: Django documentation. Tutorials. The Django Book.

Jeff Baier – Android, Python, and Django developer in Hays, KS. Today I had the task of installing a development server running the Django Python framework for one of our web developers.

Jeff Baier – Android, Python, and Django developer in Hays, KS

I learned a few things and I figured a quick tutorial might help someone else out. None of this covers new ground, but perhaps another telling of the story will help someone out there. I started from scratch, with a basic install of Ubuntu 7.04 Server Edition. I did not choose any extra packages, such as the LAMP option or DNS server. If you are starting off with a LAMP server already installed, or a different version, the steps will be similiar, but you may need to adapt some commands to get them to work. Install server software Install Apache, Mod_Python, MySQL and MySQLdb. Sudo apt-get install apache2 libapache2-mod-python sudo apt-get install mysql-server python-mysqldb Install the Django source code At this point you have a couple of options.

Cd ~/ svn co django_src Create Django’s directories Next we need to create some directories that Django will use.