WebFaction
Community site: login faq
0
1

It seems like Satchmo is the more popular choice for django based stores but I went with Lightning Fast Shop. It requires django 1.1 and Python 2.6 and runs fine on my Ubuntu box after default installation. Not so on the production server - I'm getting an ImportError that I suspect is something to do with the python path.

The error log shows the folder in question is on the python path and I've got _init_.py in the folders I'm importing so I'm running out of ideas.

So my quick question is are there any differences in the way that the python path is handled by the Redhat/mod_python setup compared to Ubuntu on my developer machine? I realize this is more a question for the django-lfs group (posted there too) but I've been stuck on this for days and looking for help anywhere.

Any help is appreciated.

asked 28 Nov '11, 23:03

Ginger_Prophet
312
accept rate: 0%

We'd be happy to look into it, but will need to see the website in question; there's no generic answer to an issue such as this.

If you are not comfortable posting a URL to your website, simply open a support ticket with the relevant details. Thanks!

(29 Nov '11, 00:13) ryans ♦♦

Here's the website in question http://gprophet.webfactional.com/

(29 Nov '11, 06:52) Ginger_Prophet

I'm not sure where you read that LFS requires Django 1.1 and Python 2.6. According to the prerequisites in the LFS docs, it can run on Python 2.6 or 2.7, and if you look at the buildout.cfg included in the LFS installer, you'll see that it pulls in Django 1.3.1.

I think the "No module named contact_form.forms" error you're currently seeing on your site is some kind of namespace collision happening because you have a mix of LFS 0.5x and LFS 0.6x packages installed in your buildout.

Instead of trying to unwind that error, I think it would be easier for you to start over with a clean install of the latest version (0.6.0b5 at the time of this writing).

I just played around with LFS a bit and got it running on mod_wsgi with Django 1.3.1. Here are the steps I took:

  • Create a new "Django 1.3.1 (mod_wsgi 3.3/Python 2.7)" app in the control panel and make a note of the app name.

  • Add the new app to your site in the control panel.

  • Create a new PostgreSQL database in the control panel and make a note of the database name and password.

  • SSH into your server and run the commands shown here, replacing 'app_name', 'db_name', and 'db_password' with the appropriate values, and providing other information when prompted. Don't copy/paste all of the commands at once - copy and paste each line individually, or type them manually: commands to run

  • Create a new "Symbolic link to static-only app" in the control panel, using "/home/your_username/webapps/your_app/lfs-installer/lfs_project/sitestatic" as the symlink path (in the "extra info" field, changing "your_username" to your WebFaction account name and "your_app" to the app name).

  • Add the symlink app that you just created to the site that's serving your LFS app, using '/static' as the URL path.

Wait a couple of minutes for that last site change to take effect, and you're ready to use the site!

Now you can go to the URL of the site and log in to your LFS shop with the superuser credentials that you created when you ran "syncdb", click "Manage", and begin adding your products, categories, pages, etc.

Just a couple of caveats:

  • These instructions might not work with any version of LFS other than 0.6.0b5.

  • If you upgrade the shop at some point, then you'll probably need to edit lfs_project.wsgi to fix all of the egg paths in sys.path. There's almost certainly a better (as in, more future-proof) way to serve a buildout-based app on mod_wsgi. Have fun with that :)

Hope that helps!

permanent link

answered 29 Nov '11, 15:24

seanf
12.2k41836
accept rate: 37%

edited 29 Nov '11, 23:30

Huge thanks seanf! I don't know where I got it stuck in my head that django1.1 was required. Just got home from work so I'll try it out now. Thanks again - I spent a good long time struggling with this.

(29 Nov '11, 18:31) Ginger_Prophet

How do you have LFS use /static and also have a /static for media files?

(21 Mar '14, 20:07) deinfinity

You are mis-reading it, it says to put the symlink app created in the previous step in /static/

(21 Mar '14, 23:34) johns

I tried the above but on a lter version of both lfs and django, but got some errors, it aperas that the last line of the script (the command list), forgets about that the file lfs_project.wsgi is located directly above the lfs-installer folder.

...so when you do: sed -i 's/myproject/lfs_project/g' ../apache2/conf/httpd.conf

you will have one additonal directory, lfs_project, in excess. Also to be mentioned is that the httpd.conf in apache points to a wsgi.py file, but in our case its name shall be lfs_project.wsgi

to make script work fully I therefore changed it to bellow, and its been tested on lfs-0.7.7 with Django 1.4.3 (mod_wsgi 3.4/Python 2.7) (port 29030):

cd ~/webapps/app_name/

./apache2/bin/stop

rm -rf lib/python2.7/{D,d}jango myproject

wget http://pypi.python.org/packages/source/d/django-lfs/django-lfs-installer-0.7.7.tar.gz

tar zxf django-lfs-installer-0.7.7.tar.gz

cd lfs-installer

python bootstrap.py

./bin/buildout -v # this will take a while to run and produce a lot of output, so be patient

sed -i "s/'ENGINE': 'django.db.backends.'/'ENGINE': 'django.db.backends.postgresql_psycopg2'/g" lfs_project/settings.py

sed -i "s/'NAME': ''/'NAME': 'db_name'/g" lfs_project/settings.py

sed -i "s/'USER': ''/'USER': 'db_name'/g" lfs_project/settings.py

sed -i "s/'PASSWORD': ''/'PASSWORD': 'db_password'/g" lfs_project/settings.py

./bin/django syncdb

./bin/django lfs_init

./bin/django collectstatic # answer YES

cat > ../lfs_project.wsgi <<EOF

import os

import sys

$( grep -B 1 -A 1 lfs-installer bin/django )

from django.core.handlers.wsgi import WSGIHandler

os.environ['DJANGO_SETTINGS_MODULE'] = 'lfs_project.settings'

application = WSGIHandler()

EOF

sed -i 's/myproject//g' ../apache2/conf/httpd.conf

sed -i 's/wsgi.py/lfs_project.wsgi/g' ../apache2/conf/httpd.conf

../apache2/bin/restart

permanent link

answered 30 Jan '13, 03:28

magnus
1
accept rate: 0%

Thanks this helped, though I had to use bootstrap.py from here http://downloads.buildout.org/2/bootstrap.py instead.

Note that the above methods remove django 1.4.3 and install django 1.3.1. Django 1.3.x is installed by the lfs 0.7.7 installer.

(16 Feb '13, 10:49) sambapati
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×337
×15
×1

question asked: 28 Nov '11, 23:03

question was seen: 6,857 times

last updated: 21 Mar '14, 23:34

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM