Forums

Django database not reflecting changes from site

Hello, I have deployed my app but when testing out my form on the site, I don't see the data in my admin database (i.e. submitting form on the website should reflect data additions in my database). I also tried adding data on the admin side and don't see changes on my site. I followed the directions to migrate in the console...but still no changes.

When testing this on my local server, it works perfectly fine. Any tips or ideas on how to fix this will be greatly appreciated! If you need more information please let me know.

if you see them in your admin console on your pythonanywhere site then the data is definitely in the database. perhaps you needed to reload your pythonanywhere webapp to see the changes?

Unfortunately I have already tried reloading to PythonAnywhere, with no luck. I was thinking that maybe I had to run the "collect static" command since I hadn't already... my site showed up fine without the command because my css is within my html files. However, it doesn't seemed to have affected it.

Update: I only see changes in my site when I directly add data from ...pythonanywhere.com/admin, not from my local admin. How do I link the two together so I don't have to make changes to each one separately?

that's because when you add on your local admin, you are adding to your local database, not the database on pythonanywhere

ok, that makes sense (the databases are separate). Now when I add data via the form on my site I do not see changes in pythonanywhere.com/admin.

Excellent, glad you've got it working now.

I have the same problem I can't add to database from my website, I guess it's something related to database settings in setting.py in django app. does anyone know how to fix this problem

If you want help you'll need to describe the problem. What error messages are you getting? What is the DATABASES setting that you're using?

i am facing issues similar to this. when i try to login i get this error: app_user there is no such table. Although everything was working fine on localhost. i have tried running the migrations as well and migrated everything but it is still showing this error

Are you using SQLite? If so, what code do you have in your settings to specify where the database should be loaded from?

I have an issue related to this, my project works with django_restframework. All changes made from the Django admin didn't reflect in the API endpoints until I refreshed the site.

Why do I have to reload the whole site to see changes in an SQlite3 DB?

That sounds like you're reading your data at import time, so it only gets re-read when you reload the web app: https://help.pythonanywhere.com/pages/GlobalStateAndWebApps/

I have the same problem waplus projectfreetv.onl

Same solution that Glenn mentioned above may apply.