3

I have a virtualbox machine running Ubuntu Server 10.04LTS. My intention is to this machine to work like a VPS, this way I can learn and prepare for when I get a VPS service.

Apache+mod_wsgi for deploying the Django app seems the right choice to me.

I have the domain (marianofalcon.com.ar) but nothing else, no DNS.

The problem is that I'm pretty lost with all the deployment stuff. I know how to configure mod_wsgi(with the django.wsgi file) and apache(creating a VirtualHost).

Something is missing and I don't know what it is. I think that I lack networking skills ant that's the big problem. Trying to host the app on a virtualbox adds some difficulty because I don't know well what IP to use.

This is what I've got:

file placed at: /etc/apache2/sites-available:

NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName www.my-domain.com
ServerAlias my-domain.com
Alias /media /path/to/my/project/media

DocumentRoot /path/to/my/project
WSGIScriptAlias / /path/to/your/project/apache/django.wsgi
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>

django.wsgi file:

import os, sys

wsgi_dir = os.path.abspath(os.path.dirname(__file__))
project_dir = os.path.dirname(wsgi_dir)
sys.path.append(project_dir)
project_settings = os.path.join(project_dir,'settings')
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
2
  • This stuff seems right at first glance, provided you have loaded wsgi modules in apache. What's the exact error you get when browsing my-domain.com?
    – Jasper
    Jul 27, 2010 at 16:44
  • Server not found. I guess I've to have a DNS, but I don't know how to do this: ¿Did I need to install a DNS Server?
    – mfsaint
    Jul 27, 2010 at 21:39

1 Answer 1

1

Yes, you need DNS or something local to substitute it if you stay in LAN.
Not sure how is your network (at least between host and VM) but it would be easier to have your VM on the same network as you machine (bridged, not NATed). Now you can use the /etc/hosts file on the VM to make it accessible:

127.0.0.1        localhost.localdomain  localhost
192.168.xxx.xxx  www.my-domain.local    www

For example. If you have public IP and want this to be reached from outside (a real setup), use your registered domain name but you'll need to define at least 2 DNS servers for it (on http://www.nic.ar) and actually have the 2 DNS resolving to your IP. There are free DNS servers or as you have already a ubuntu server on, you can install a DNS server on it, for a single site access it's easy (and good to know! :) ).

OBS: to answer when you said that due to it be a VM you are not sure what IP to use: VM or not, it is a server, so you define and fix its IP (hosts file and /etc/network/interfaces or use your DHCP to give it always the same IP) so you (and the network :) ) will always know how to reach it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .