Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7773423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:07:58+00:00 2026-06-01T17:07:58+00:00

This one has me scratching my head. I have an app with views that

  • 0

This one has me scratching my head. I have an app with views that do form processing (logins/signup) and then return various HttpResponseRedirect()s based on the input. All of those redirects contain reverse() lookups with the appropriate functions listed as strings. And every function has a corresponding urlpattern in urls.py.

Everything was working fine until this morning.

Now, whenever I submit a form, Django gives me a syntax error for a non-existent line:

SyntaxError at /logout/
invalid syntax (views.py, line 399)

(That file only has 354 lines)

When I scroll down to look at the traceback, the line that’s highlighted is always one with a return HttpResponseRedirect( reverse('app.views.func') ).

Because of these bewildering error messages, I’m not even sure that the problem is really with the HttpResponseRedirect( reverse() )s. I haven’t touched any of that code in a few days, so I’m not sure why it would suddenly start throwing out weird errors like that.

Any help debugging this would be much appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:07:58+00:00Added an answer on June 1, 2026 at 5:07 pm

    I finally figured it out after consulting the docs for the reverse() function.

    When you call reverse(), django first imports your project’s URLConf files, which in turn imports every single view module that is declared in your URLconf. My issue was that I was working on a new, totally unrelated view that had a syntax error (on line 399!).

    So even though I wasn’t viewing a page that was doing anything with the new view, my old view was still getting tripped up with the syntax error because of how reverse() works.

    From the docs:

    Make sure your views are all correct. As part of working out which URL
    names map to which patterns, the reverse() function has to import all
    of your URLconf files and examine the name of each view. This involves
    importing each view function. If there are any errors whilst importing
    any of your view functions, it will cause reverse() to raise an error,
    even if that view function is not the one you are trying to reverse.

    Make sure that any views you reference in your URLconf files exist and
    can be imported correctly. Do not include lines that reference views
    you haven’t written yet, because those views will not be importable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm scratching my head over this. I have a moderately successful app which has
This one has me scratching my head, so I'm hoping a second pair of
I'm really scratching my head on this one: I have an object (MyObject) which
This one has been driving me nuts. I have a div that has it's
This one has me scratching my head. I'm running Subversion 1.3.1 (r19032) on Ubuntu.
This one has really got me stumped. I have certain forms that are being
It turns out that in order to do this one has to bind the
I'm sure someone can explain this. we have an application that has been in
This one has got me stumped. I am currently rendering a form using ASP
Alright, this one (3a; sample problem with provided answer) has got me scratching my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.