Forums

OperationalError at /

I am trying to run my django project on PythonAnywhere and keep getting the error OperationalError at / no such table: baadalbeats_song

Make sure that you've run manage.py makemigrations and manage.py migrate

hello community I run into this problem when I am almost at the end of developing my application, I got "maximum recursion depth exceeded while calling a Python object" the project could not load at all. can anyone help me resolve this problem. Thanks

You've got some recursive loop (e.g. a function calling itself in infinity) in your code. Look at the traceback message and try to find where in the code it's happening.

it is happening in an "is" statement" which I used to load a navigation bar for logged in users. apparently it was working very well but all of a sudden this error came up. References indicate that I should increase the recursion limits but I don't know where to increase the recursion limits. In what module or in what file .py or ... no clue.

"If statement" ; I mean

You can increase the recursion by using sys module -- have a look at the docs (esp. getrecursionlimit and setrecursionlimit functions).

I had done all what I am supposed to do as per the "the docs" but still could get the site load. what could I have done wrong. Can anyone tell me exactly why my "setrecusionlimit(1100) is not working. am kinda stranded right now.

If you've got a function that calls itself without any way of stopping, then changing the recursion limit won't help. For example, consider this:

def f():
    f()

f()

If you were to run that code, then it would just hang until the stack that Python uses to keep track of function calls fills up.

My guess is that your code is accidentally doing something equivalent to that, but in a much less obvious way (because of course you'd see the problem immediately if it was as clearly wrong as my example code).

Perhaps you could post your "if" statement here to see if extra eyes looking at it can identify what is going wrong?

.

<div class="navbar navbar2-responsive navbar2-flex-top ">
        <div class="container-fluid ">
              {% if request.user.is_authenticated %}
              <hr><br><a class=" my-4 my-md-4 mr-md-auto bg-light"></a>
              <span class="navbar2-toggler-icon"></span>
                <li><a class="p-4   text-blue font-cambria" href="{% url 'chat' %}">Video Chat</a></li>
                <li><a class="p-4   text-blue font-cambria" href="#">Live Stream</a></li>
                <li><a class="p-4   text-blue font-cambria" href="#">Join Meeting</a></li>
                <li><a class="p-4   text-blue font-cambria" href="#">Collaborate</a></li>

             <ul aria-labelledby="blog" class="px-4 navbar2-link dropdown-menu">Blog
               <li><a class="p-2 text-dark dropdown-item" href="blog/create">Create Blog</a></li>
               <li><a class="p-2 text-dark dropdown-item" href="blog/edit"> Edit Blog</a></li>
               <li><a class="p-2 text-dark dropdown-item" href="#"> detail Blog</a></li>
               <li><a class="px-4 navbar-link justify-end" href="{% url 'logout' %}">Logout</a></li>
            </ul>
            {% endif %}
          </div>
        </div>

[edit by admin: formatting]

this is just a navigation that is loaded only when the user is authenticated. I don't see any problem with this but the error points to this statement. when I run the "Python manage.py runserver" it does not give me any error message but when I LOAD THE "localhost:8000" it gives me the following error. To share the error message:

Error during template rendering
In template C:\xircun-conference\Xircun\src\templates\snippets\header.html, error at line 252
maximum recursion depth exceeded while calling a Python object

Line 252 is "if" statement

</div>
252                   {% if request.user.is_authenticated %}
253                   <!-- show app navigation bar -->
254                   <nav class="navbar navbar2-responsive navbar2-flex-top ">
255                         <div class="container-fluid ">

[edit by admin: formatting]

Thanks for the details. These are the forums for PythonAnywhere, a specific hosting environment for Python websites, so we can't in general give detailed help on running things on your own machine.

However, it sounds from your description like you might have overridden the is_authenticated property on your user objects, or something like that.

Perhaps you could try posting on a general programming help site like Stack Overflow? If you are doing custom stuff with is_authenticated, that would also be relevant for people trying to help.