Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sat Nov 26, 2011 11:54 pm 
Offline
Senior Newbie

Joined: Sat Nov 26, 2011 11:35 pm
Posts: 14
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/

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

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 <module>
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 "<stdin>", line 1, in <module>
ImportError: No module named django


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


Thanks!


Top
   
 Post subject: sudo
PostPosted: Sun Nov 27, 2011 12:04 am 
Offline
Senior Newbie

Joined: Sat Nov 26, 2011 11:35 pm
Posts: 14
Ran all commands under sudo as well as my unprivileged user


Top
   
 Post subject:
PostPosted: Sun Nov 27, 2011 7:19 am 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
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
Code:
source bin/activate
it should set up your python path properly.

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
 Post subject:
PostPosted: Sun Nov 27, 2011 1:04 pm 
Offline
Senior Newbie

Joined: Sat Nov 26, 2011 11:35 pm
Posts: 14
obs wrote:
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
Code:
source bin/activate
it should set up your python path properly.


Hi Obs,

I'm unsure what your code
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/


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...

Code:
<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>


Top
   
 Post subject:
PostPosted: Sun Nov 27, 2011 2:17 pm 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
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/<website>", "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/$DJANGO_PROJECT_NAME/venv/bin/, where $DJANGO_PROJECT_NAME is the one set during StackScript deployment (default: my_project). Once you do "source /srv/$DJANGO_PROJECT_NAME/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/$DJANGO_PROJECT_NAME, picking up the Django tutorial at that step.

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
 Post subject:
PostPosted: Sun Nov 27, 2011 2:23 pm 
Offline
Senior Member

Joined: Mon Dec 07, 2009 6:46 am
Posts: 331
Using virtualenv is highly recommended, though.


Top
   
 Post subject:
PostPosted: Sun Nov 27, 2011 2:55 pm 
Offline
Senior Newbie

Joined: Sat Nov 26, 2011 11:35 pm
Posts: 14
hoopycat wrote:
Once you do "source /srv/$DJANGO_PROJECT_NAME/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/$DJANGO_PROJECT_NAME


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

Thanks again!



Benjamin


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group