0

I'm a n00b in django, I have done the polls tutorial and not too much more. I want to set up an online shop with Lightning Fast Shop (LFS), which does pretty much anything I need. I know it would be desirable to have a better django base...

One of the first steps I want to do, is to customize a little bit the templates. Here is an explanation about how to do it:

http://play.pixelblaster.ro/blog/archive/2009/09/17/customizing-django-lfs-lightning-fast-shop-for-the-non-django-developer

The FLS frameworks is properly installed: I can open the site, define products, add products to the cart, etc.

I have configured the settings.TEMPLATE_DIRS so that it points to a inner folder into my project. It seems I got it right, because when I drop there a template base.html, I get the following error:

NoReverseMatch at /
'url' requires a non-empty first argument. The syntax changed in Django 1.5, see the docs.

... a lot of information...

Error during template rendering

In template c:\development\......\lfs-installer\lfs_project\theme\templates\lfs\base.html, error at line 47
'url' requires a non-empty first argument. The syntax changed in Django 1.5, see the docs.
37              <script type="text/javascript" src="{{ STATIC_URL }}jquery/lightbox/jquery.lightbox-0.5.js"></script>
38              <script type="text/javascript" src="{{ STATIC_URL }}js/lfs.js"></script>
39          {% endcompress %}
40  
41      </head>
42      <body class="{% block section %}lfs{% endblock %}">
43          <div id="header">
44              <div class="container">
45                  {% block header %}
46                      <div class="span-6 logo">
47                          <a href="{% url lfs.core.views.shop_view %}">
48                              <img class="logo"
49                                   src="{{ STATIC_URL }}img/logo.jpg"
50                                   alt="Logo" />
51                          </a>
52                      </div>
53                      <div class="span-18 search last">
54                          {% if user.is_authenticated %}
55                              {% if user.first_name %}
56                                  <span>{{ user.first_name }} {{user.last_name}}</span>
57                              {% else %}

I have tried to copy the whole templates from the flstheme package, but it still does not work.

There are good explanation on this topic for pure django, but it FLS is an extra complexity layer and I cant get it right. Thanks a lot in advance.

EDIT This is a freeze of my virtualenv:

Django==1.6.5
Pillow==1.7.5
South==0.7.3
django-appconf==0.6
django-compressor==1.1.1
django-countries==1.5
django-lfs==0.7.8
django-lfstheme==0.7.4
django-pagination==1.0.7
django-paypal==0.1.2
django-piston==0.2.3
django-portlets==1.1.1
django-postal==0.92
django-reviews==0.2.1
django-tagging==0.3.1
lfs-contact==1.0
lfs-order-numbers==1.0b1
six==1.7.3
bgusach
  • 14,527
  • 14
  • 51
  • 68

1 Answers1

1

As the traceback states, the url tag in line 47 should look like this

{% url 'lfs.core.views.shop_view' %}

This has been changed in Django 1.5.

Make also sure that you are using Django 1.3.* with LFS 0.7.*. If you do this, the above error shouldn't rise up at all.

LFS 0.9 (which is in alpha state at the moment) is using Django 1.6.*, though.

  • Thanks, that seems to solve the problem. But the overriding template and the overriden one are the same. Why does it work properly if I don't override? i.e. the templates from site-packages are used? it's confusing... – bgusach Jul 19 '14 at 13:57
  • Yes, that's indeed strange. Are you sure that you don't mess up something with different Django versions? – Kai Diefenbach Jul 19 '14 at 14:29
  • I'm using a virtualenv with django 1.6.5, and the only thing I do is drop in the templates folder the base.html, and refresh the browser. – bgusach Jul 19 '14 at 14:36
  • Which LFS version do you use? – Kai Diefenbach Jul 19 '14 at 14:40
  • I updated my question. I thought I had the `0.9 beta`, but it is the `0.7.8`... I installed django and lfs separately from `pip`, that would explain something. – bgusach Jul 19 '14 at 20:29
  • Well this is very weird, I installed `Django 1.3.7` and pretty much the same problem. It works when the template is loaded from site-packages, but when I use the template copied in my project folder, it crashes... :S – bgusach Jul 19 '14 at 21:19
  • Weird indeed. I've really no idea what's happening on your side, sorry. The only thing I can suggest is to create a new virtualenv and install LFS via the installer the way it is described within the documentation: http://docs.getlfs.com/en/version-0.7/introduction/installation.html – Kai Diefenbach Jul 20 '14 at 08:03
  • Ditto! I created a new environment from scratch, and just did `python bootstrap.py`. No `pip`. The only thing I had to figure out was to call `bin\django.exe migrate` after `syncdb`... otherwise some tables would not be built. Thanks for everything! – bgusach Jul 20 '14 at 13:56