Hopefully a quick url question

0 views
Skip to first unread message

joshm

unread,
Oct 5, 2008, 2:57:26 PM10/5/08
to Satchmo users
When I go to my store base url I get:

mywebsite.com/store/

When I browse to a product I get this url:

mywebsite.com/my_project/store/category/book/nonfiction

How can I change this so that my_project is not present in the url or
is something other than the name of my project?

joshm

unread,
Oct 5, 2008, 4:00:30 PM10/5/08
to Satchmo users
Still pulling my hair out on this one. All of the urls work without
the projectname pre-pended to the url so:

mywebsite.com/store/contact

is the same as:

mywebsite.com/my_project/store/contact

unfortunately I still can't figure out how to make satchmo write all
of the urls without the projectname?

Perhaps this was done when I did the database setup? I do have values
in DJANGO_PROJECT and SITE_NAME and changing them does not seem to
make any difference.

I know this can work because the demo store behaves this way...

??

Chris Moffitt

unread,
Oct 5, 2008, 4:07:02 PM10/5/08
to satchm...@googlegroups.com
I'm honestly not sure where the "my_project" is coming from. Could you post your urls.py to dpaste? It may be a misconfiguration there.

-Chris

joshm

unread,
Oct 5, 2008, 4:26:13 PM10/5/08
to Satchmo users
I posted all of my settings files, with most of my (ir)relevant
information removed.

Here is the urls.py (pretty much the default):

http://dpaste.com/82540/

Here is the settings.py for the project:

http://dpaste.com/82544/

and my local_settings.py here as well:

http://dpaste.com/82546/

I'm just trying to get the layout to work correctly on a vm so I have
no problem snapping back and starting over...or testing anything else
for that matter (this is using the satchmo turnk btw)

Thanks!

Chris Moffitt

unread,
Oct 5, 2008, 4:35:18 PM10/5/08
to satchm...@googlegroups.com
One other thing, are you running this on the built in server or is this running somewhere else? It's possibly your web server might be adding the extra path info.

-Chris

joshm

unread,
Oct 5, 2008, 4:53:41 PM10/5/08
to Satchmo users
Arggh..my mistake. Thanks for your help, sometimes the mind just
needs a kick. Your mention of the webserver made me double check my
httpd.conf

It had:

PythonOption django.root /my_project

Removing that did the trick.

Sorry to trouble ya on this Sunday afternoon.

Thanks for your help.

Shankar Dhanasekaran

unread,
Oct 6, 2008, 4:46:44 AM10/6/08
to satchm...@googlegroups.com

I guess it's from this. I had a similar situation and messed with some settings detailed below and got it working. I don’t actually remember what I did, but I guess I removed the 'PythonOption django.root /mysite' option in apache config.


          From http://docs.djangoproject.com/en/dev/howto/deployment/modpython/

          New in Django 1.0: The PythonOption django.root ... is new in this version.

          Because mod_python does not know we are serving this site from underneath the /mysite/ prefix, this value needs to be passed through to the mod_python handler in Django, via the PythonOption django.root ... line. The value set on that line (the last item) should match the string given in the <Location ...> directive. The effect of this is that Django will automatically strip the /mysite string from the front of any URLs before matching them against your URLConf patterns. If you later move your site to live under /mysite2, you will not have to change anything except the django.root option in the config file.

          When using django.root you should make sure that what's left, after the prefix has been removed, begins with a slash. Your URLConf patterns that are expecting an initial slash will then work correctly. In the above example, since we want to send things like /mysite/admin/ to /admin/, we need to remove the string /mysite from the beginning, so that is the django.root value. It would be an error to use /mysite/ (with a trailing slash) in this case.

          Note that we're using the <Location> directive, not the <Directory> directive. The latter is used for pointing at places on your filesystem, whereas <Location> points at places in the URL structure of a Web site. <Directory> would be meaningless here.

          Also, if your Django project is not on the default PYTHONPATH for your computer, you'll have to tell mod_python where your project can be found:

          <Location "/mysite/">

              SetHandler python-program

              PythonHandler django.core.handlers.modpython

              SetEnv DJANGO_SETTINGS_MODULE mysite.settings

              PythonOption django.root /mysite

              PythonDebug On

              PythonPath "['/path/to/project'] + sys.path"

          </Location>

Does this sound anything meaningful?


~Shakthi

Reply all
Reply to author
Forward
0 new messages