-1

I would like to learn how to use django, but I have no experience with servers (don't know how to use apache..) and am having trouble getting started. If I only have access to my home directory on a shared server, how should I proceed? How do I choose between and set up mod_python, mod_wsgi, etc.? Where is my httpd.conf file?

It would be helpful if you could explain in plain English but note relevant tech lingo as you go.

Thanks much.

womble
  • 95,029
  • 29
  • 173
  • 228

2 Answers2

1

If you are only learning Django, you do not need to be hosting it with Apache. Instead, use the Django builtin development server as described in the Django tutorial and documentation. Only after you have actually learnt the basics of using Django, should you bother to look at hosting mechanisms for deploying it on an actual site.

In other words, don't get ahead of yourself, work out one step at a time and for that first step of learning Django, you do not need Apache.

Graham Dumpleton
  • 5,990
  • 2
  • 20
  • 19
0

As Graham Dumpleton said, the development server is the best place to start and will run on your localhost (your machine) so you wont't have problems. (I voted on his answer as it is the right way to learn django in my opinion too).

But I'm sure you want to see something on your hosted site too! :) and you could start to see how it works in paralell and be prepared to transfer you django initial experiences there (it won't take long to build something usable in django). So to answer your apache related questions:

  • mod_python x mod_wsgi: wsgi is recomended but not sure your hosting allows wsgi as it requires restarting apache sometimes (mainly at the begining:) ) - mine doesn't allow.

  • where is httpd.conf: on the server but you have no access to it (the same applies for apache2.conf) as it is shared and the config is for all the hosted sites so you will use the 3rd place where apache accepts configurations: .htaccess files in your workarea. Almost everything in httpd.conf can go in .htaccess and will be a local conf for your site. Usually, your home directory is the DocumentRoot of your site. You can create directories there to use as DocumentRoots for "sub-sites" and I think you are probably better doing this so you can have multiple sites (and find their files later...).

    You save the configurations like:

    <Location "/folder_name">
        SetHandler None
    </Location>
    

in .htaccess files instead of httpd.conf or files in sites-enabled directory. For example to use mod_python you can use:

SetHandler mod_python
PythonHandler mod_python.cgihandler

in .htaccess file too.

I hope this can let you start "investigating" how it works... but probably your hosting company has a tutorial on how to do that on their server.

But be sure to use the development server for django beginnings or you'll loose your time on server config instead of learning django and Django's Doc tutorial is made to use the development server.

OBS .htaccess files are dot files, not "extensions" like something.htaccess

laurent
  • 2,035
  • 16
  • 13