Django Help! Linode Stack Install Script, NOW WHAT?!

So i want to do some Python dev, using Django. I found this video and watched it a few times to try and get started.

http://net.tutsplus.com/tutorials/pytho … c-website/">http://net.tutsplus.com/tutorials/python-tutorials/python-from-scratch-creating-a-dynamic-website/

I've installed a Ubuntu Server using this "Security, PostgreSQL/MySQL/MongoDB, Apache, Django" Linode Stack Script. … http://www.linode.com/stackscripts/view … riptID=131">http://www.linode.com/stackscripts/view/?StackScriptID=131

However, I'm totally stuck and need help. my site http://yozomo.com/ is working so you'd assume everything is working fine. DB installed, Python and Django installed however, on the "django step" for making an app..

python manage.py startapp whiskey…

I get this…

benjamin@thallium:/srv/website/app/webapp$ python manage.py startapp whiskey

Traceback (most recent call last):

File "manage.py", line 2, in from django.core.management import execute_manager

ImportError: No module named django.core.management

ALSO this seems to be an error…

benjamin@thallium:/srv/website/app/webapp$ python

Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)

[GCC 4.4.3] on linux2

Type "help", "copyright", "credits" or "license" for more information.

from django import get_version

Traceback (most recent call last):

File "", line 1, in ImportError: No module named django

If anyone can offer help and the next step i'm totally missing please help.

Thanks!

6 Replies

Ran all commands under sudo as well as my unprivileged user

Your PYTHONPATH is probably missing the path to django, it appears the stack script you used stores sites in virtualenvs inside /srv so if you cd /srv/[your project name] then run source bin/activate it should set up your python path properly.

@obs:

Your PYTHONPATH is probably missing the path to django, it appears the stack script you used stores sites in virtualenvs inside /srv so if you cd /srv/[your project name] then run source bin/activate it should set up your python path properly.

Hi Obs,

I'm unsure what your code source bin/activate is actually suppose to be… I understand that I'm not linking something correctly.

I've been trying to adapt this guide to my system unsucessfully.. http://felecan.com/2011/definitive-guid … go-ubuntu/">http://felecan.com/2011/definitive-guide-installing-django-ubuntu/

My structure of /srv is ..

/srv

-> website

-> -> app

-> -> -> webapp

init.py manage.py settings.py urls.py

And my /etc/apache2/sites-available/yozomo.com file looks like this…

 <virtualhost *:80="">ServerAdmin zobrakster@yahoo.com
    ServerName yozomo.com

    Alias /site_media/ /srv/website/app/webapp/site_media/
    Alias /media/ /srv/website/venv/lib/python2.6/site-packages/django/contrib/admin/media/
    Alias /robots.txt /srv/website/app/webapp/site_media/robots.txt
    Alias /favicon.ico /srv/website/app/webapp/site_media/favicon.ico

    CustomLog "|/usr/sbin/rotatelogs /srv/website/logs/access.log.%Y%m%d-%H%M%S 5M" combined
    ErrorLog "|/usr/sbin/rotatelogs /srv/website/logs/error.log.%Y%m%d-%H%M%S 5M"
    LogLevel warn

    WSGIDaemonProcess yozomo.com user=benjamin group=benjamin processes=1 threads=15 maximum-requests=10000 python-path=/srv/website/venv/lib/python2.6/site-packages python-eggs=/srv/website/run/eggs
    WSGIProcessGroup yozomo.com
    WSGIScriptAlias / /srv/website/app/conf/apache/django.wsgi

    <directory srv="" website="" app="" webapp="" site_media="">Order deny,allow
        Allow from all
        Options -Indexes FollowSymLinks</directory> 

    <directory srv="" website="" app="" conf="" apache="">Order deny,allow
        Allow from all</directory></virtualhost> 

It looks like the felecan.com guide doesn't use virtualenv (which is why it goes into all those weird steps to install Django), so it won't (directly) apply to this situation. (With virtualenv, the installation step would have consisted of "cd /home/", "virtualenv –no-site-packages venv", "source venv/bin/activate", "pip install Django", and finally "django-admin.py startproject website".)

You should have a script called 'activate' in /srv/$DJANGOPROJECTNAME/venv/bin/, where $DJANGOPROJECTNAME is the one set during StackScript deployment (default: myproject). Once you do "source /srv/$DJANGOPROJECTNAME/venv/bin/activate", a little (env) will appear in your prompt and then you should be able to "python manage.py startapp whiskey" from /srv/$DJANGOPROJECT_NAME, picking up the Django tutorial at that step.

Using virtualenv is highly recommended, though.

@hoopycat:

Once you do "source /srv/$DJANGOPROJECTNAME/venv/bin/activate", a little (env) will appear in your prompt and then you should be able to "python manage.py startapp whiskey" from /srv/$DJANGOPROJECTNAME

Yes yes, Thank you very much that was it. I missed the "activate" command. All is well now.

Thanks again!

Benjamin

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct