There is a site on Flask hosted on the Internet and the admin to it as a separate project on the local machine.

If you insert a new entry into the database from the admin, then another application will see the changes only after the uwsgi server is restarted. How to fix it?

And in general, is it a good idea to do admin panel as a local project? The scheme is as follows: port knocking + ssh-tunnel to the MySQL server

  • From a practical point of view, the idea is not very good, because, firstly, do not get away from the cell phone (or you may need it), and secondly, the DB glow outside, which gives the potential possibility of password retrieval / leakage and database drain - andreymal
  • But after all, the port is closed in iptables and opens only for my ip if I knock on port knocking and it is automatically deleted in an hour - Viktor
  • I had to carefully read the end of the question -_- Then the first paragraph still remains) - andreymal

2 answers 2

Found a solution in another matter

It was about the transaction isolation level, it needs to be set to 'READ COMMITTED':

cnx.start_transaction (isolation_level = 'READ COMMITTED')

    if I understand correctly, are you two database servers simultaneously accessing the same files containing the database?

    if so, then, as far as I know, the mysql server is not suitable for such use, and sooner or later the database may be destroyed.

    The inconsistency of the data you already observe, it remains the case for the "successful" coincidence of circumstances.

    • No, the database server is one - remote, just if the data is not changed by the application on this server but by another application or I manually enter the request in the mysql console, the application does not see these changes until it is rebooted. I got the idea to make a request for ssh to the server and execute the command touch /my_project.ini, but this seems to be a crutch ... - Viktor
    • this means that the program is a mysql client (I don’t know what the flask is , but apparently this is it) - caches data received from the mysql server (I suspect that these are not the results of the sql queries, but based on them some data structures). perhaps it has some kind of opportunity to repeat all requests and form structures again (well, besides the restart you are using). - aleksandr barakin