I am beginning a new project that uses MEAN.JS (MongoDB, ExpressJS, AngularJS, Node.js). I use Apache as my webserver on my local Ubuntu VM. When I first read about using Express, I wondered how I would use Express and Apache together. Further confusion came when I learned that my host provider (webfaction uses Nginx to serve static files and Apache for PHP and other server-side technologies. So Node.js and Express will actually be running under Nginx. Because I wanted my development environment to be enulate production as much as possible, I decided to run Nginx and Apache together.
As part of the Mobile Theme Generator, I had to create a Photo Gallery in order to display the header images. As stated in previous post, I created the Mobile Theme Generator using Django and jQuery Mobile. Although there are probably plenty of Django-based Photo Gallery apps, I thought that it would be easier to integrate a custom Photo Gallery into a generator, so I decided to build it myself.
When I first created MobilePebbles , the Mobile Theme Generator was installed on the primary domain. I soon decided to place the generator on a sub-domain and install Mezzanine on the primary. The site is hosted by Webfaction. Although Webfaction has install scripts for quite a few apps (Drupal, Django, etc), they do not currently have one for Mezzanine. But, without too much trouble (thanks to the tools that are availed to Webfaction customers), I was able to install Mezzanine on Webfaction.
Although there are many advantages to installing Mezzanine using Python’s virtual environment, I decided against it. I already have Django installed on Apache using mod_wsgi, so my Ubuntu install is already primed. Although I followed the basic steps as discussed in a previous post (Setting up Django with Apache and mod_wsgi on Ubuntu 11.10), there were a bit more steps involved with setting up Mezzanine – especially as it relates to how and where to serve static files.
A few months ago, I downloaded a mobile theme for WordPress in order to create a mobile site for GrasshopperPebbles. While updating the template, I thought about automating the development process so that future releases would be easier. So I decided to create an open source project – the mobile theme generator. The generator displays mobile sites using jQuery Mobile. In fact, the generator itself was developed using Django and jQuery Mobile (the original theme used jQuery Mobile). I did think that it an odd solution to create PHP files using Python, but it turned out to be a great solution.
After I finished reading the First Steps tutorials on Django’s website, I realized that the documentation did not discuss how to set up a home page. Because Django projects are collection of configurations and apps, I decided that the best way to set up a home page was to create an app.
In my last post, I discussed how to set up Django with Apache and mod_wsgi. In this post, I will discuss how to set up a sub-domain to serve static files (css, js, images, etc). The Django documentation states that using a sub-domain for static files is recommended.
Note: Although I set up my Django installation on Ubuntu, most of these instructions are common to most OS’s.
I beginning a new project where I decided to use Django. I briefly worked with Django for an embedded device over two years ago. Now I am creating a full-fledged web application using Django and jQuery.
When setting up Django, I initially followed the tutorials on djangobook.com. While the site is a good starting point for learning Django, it lacks some details, especially as it relates to serving static files (css, js, etc.) while using the development server. After struggling with the display of my css files, I decided to use Apache instead of the development server. After all, the development server will not be used in production, so I would rather duplicate a production environment as much as possible. In my opinion, the primary reason for using the development server is for debugging, but so far, I have found that Apache’s error log has been pretty good.