Django project #1: Install
This is my OLD blog. I've copied this post over to my NEW blog at:
http://www.saltycrane.com/blog/2007/11/django-project-1-install/
You should be redirected in 2 seconds.
I plan to do a side project in Django just to get some web programming experience. I'm not sure exactly what the site will be yet. Maybe my very own blog software with extensive tagging capabilities and maybe revision control. I also have an idea for a site to specialize in comparison searching. E.g. "python vs. ruby", "mac vs. linux", "kde vs. gnome", etc. Or, if I find someone who needs a website, I might work someone else's project. As long as I get to choose the technology. Anyways, I plan to document my steps here. I've already installed Ubuntu. Here are my steps in creating my Django website.
Install django
$ sudo apt-get install python-django
Test install
To test the install, I typed import django in the python interpreter.
$ python Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import django >>>Alright, It worked.
Create a project
I tried to follow the Django tutorial and ran the django-admin.py command. However, I got the command not found error message.
$ django-admin.py startproject mysite bash: django-admin.py: command not foundI googled for the error message and found this link which said to link the django-admin.py file to a location in your path.
$ sudo ln -s /usr/lib/python-django/bin/django-admin.py /usr/local/bin/django-admin.pyI tried the django-admin.py command again, and now got a Permission denied error.
$ django-admin.py startproject mysite bash: /usr/local/bin/django-admin.py: Permission deniedGoogling again, I found the SVN release version of the tutorial which gave instructions about the Permission denied error. (I was using the 0.96 version of the tutorial). So I changed the permissions of the django-admin.py file to be executable.
$ sudo chmod +x /usr/lib/python-django/bin/django-admin.pyI tried the command again.
$ django-admin.py startproject mysiteAlright, success! I got no errors.
Start the development web server
$ cd mysite $ python manage.py runserver Validating models... 0 errors found. Django version 0.96, using settings 'mysite.settings' Development server is running at http://127.0.0.1:8000/ Quit the server with CONTROL-C.Alright, it worked! I know you are excited. I visited http://127.0.0.1:8000/ in my browser and got a nice page affirming me of my success.
It worked!
Congratulations on your first Django-powered page.
No comments:
Post a Comment