Note that there are some explanatory texts on larger screens.

plurals
  1. POLinks in Django
    text
    copied!<p>I'm trying to get my links working in Django. All the URLs work when typed in, but I can't figure out the internal navigation. They are all of the format app.com/storename/pagename, so if I'm on app.com/shoestore/products and click on location, I should go to app.com/shoestore/location. I'm losing the shoestore part. </p> <p>Here's a sample view:</p> <pre><code>def homepage(request, store_subdomain): store_db, store_products = database_selector(store_subdomain) return render_to_response('base.html', {'store_name': store_db.name, 'store_subdomain':store_subdomain}) </code></pre> <p>My urls.py:</p> <p>urlpatterns = patterns('',</p> <pre><code>url(r'^admin/', include(admin.site.urls)), url(r'^(?P&lt;store_subdomain&gt;\w+)/$', homepage), url(r'^(?P&lt;store_subdomain&gt;\w+)/products/$', products), url(r'^(?P&lt;store_subdomain&gt;\w+)/shoppingcart/$', shoppingcart), url(r'^(?P&lt;store_subdomain&gt;\w+)/checkout/$', checkout), url(r'^static/(?P&lt;path&gt;.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}), url(r'^media/(?P&lt;path&gt;.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), </code></pre> <p>)</p> <p>and my navigation tag:</p> <pre><code>&lt;li&gt;&lt;a href = "/"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href = "/products/"}&gt;Products&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href = "/location/"&gt;Location&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="mailto:{{store_db.email}}"&gt;Email Us&lt;/a&gt; &lt;/li&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload