문제

I'm running Django 1.5.2 and installed Zinnia Blog but I'm getting a Syntax error in some of the templates. An example is in skeleton.html on this line:

<link rel="index" href="{% url 'zinnia_entry_archive_index' %}" />

The 'zinnia_entry_archive_index' part is highlighted specifically. If I remove the line, I just get the same syntax error somewhere else, which leads me to think that it's not something specifically in this line but maybe something to do with the use of the "url" part.

Do I need to have something installed to use it? Or is there something else I'm missing?

Thanks.

도움이 되었습니까?

해결책

As I thought, the error had absolutely nothing to do with Zinnia. It was a syntax error being exposed in my own code in a completely random place. I was using an exception without a try in there. Rookie error:

except User.DoesNotExist:
    return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

Lesson learnt: Don't rely on the Django errors in the browser. If they're confusing, check the actual apache error logs! Because no doubt you'll see something like this:

File "../project/users/api/views.py", line 76
    except User.DoesNotExist:
         ^

It's working now at least!

다른 팁

You have no "+" between the variable URL and the string 'zinnia...'

To add (concatenate) two string you need to put a plus operator between them, that seems like it would be a problem.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top