Jump to content

talesaz

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by talesaz

  1. I understand that the database connection limit on HelioHost is restricted to 10 simultaneous connections. To ensure that my application does not exceed this limit, I tried two different approaches, but both resulted in errors. First Approach: Using SQLAlchemy Advanced Configuration I configured the SQLALCHEMY_ENGINE_OPTIONS as follows: SQLALCHEMY_ENGINE_OPTIONS = { 'pool_size': 5, 'max_overflow': 2, 'pool_timeout': 20, 'pool_recycle': 280, 'connect_args': { 'connect_timeout': 10 # 10-second timeout for database connections } } However, this resulted in the following errors: 2025-04-16 03:19:26 Error 186.205.7.186 504 GET /bma/ HTTP/1.0 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 967 Apache SSL/TLS access 2025-04-16 03:19:47 Error 186.205.7.186 504 GET /bma/flask.wsgi/usuarios HTTP/1.0 https://talesaz.heliohost.us/bma/flask.wsgi/usuarios/11 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 967 Apache SSL/TLS access 2025-04-16 03:20:26 Error 186.205.7.186 Timeout when reading response headers from daemon process 'talesaz_wsgi': /home/talesaz.heliohost.us/httpdocs/bma/flask.wsgi Apache error Second Approach: Managing Connections Manually I then tried to manually open and close connections for each request using the following code: @app.before_request def before_request(): g.db = db.session() @app.teardown_request def teardown_request(exception): db.session.remove() Unfortunately, this also resulted in errors: 2025-04-16 03:55:58 Error 186.205.7.186 500 GET /bma/ HTTP/1.0 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 986 Apache SSL/TLS access 2025-04-16 03:59:18 Error 186.205.7.186 500 GET /bma/ HTTP/1.0 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 986 Apache SSL/TLS access Could you please provide any guidance or tips on how to ensure that my application does not exceed the connection limit imposed by HelioHost? I would greatly appreciate any advice on how to configure SQLAlchemy or manage connections more effectively in this environment. Thank you in advance for your help!
  2. Hi Guy, Could you create a second website,talesazoeto.heliohost.us (or something similar), with WSGI restart access enabled? Thank you so much!
  3. Now it works! Thank you so much! Sometimes the website still shows a 500 Internal Server Error, but much less frequently than yesterday, and refreshing the page usually resolves it. The logs don’t provide much information about how to address the issue: 2025-04-15 23:28:23 Error 186.205.7.186 500 GET /bma/flask.wsgi/usuarios/cadastrar HTTP/1.0https://talesaz.heliohost.us/bma/flask.wsgi/conteudo Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 1000 Apache SSL/TLS access 2025-04-15 23:28:25 Access 186.205.7.186 200 GET /bma/flask.wsgi/usuarios/cadastrar HTTP/1.0https://talesaz.heliohost.us/bma/flask.wsgi/conteudo Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 10.8 K Apache SSL/TLS access If you could provide more detailed logs for this event at this timestamp, I would greatly appreciate it.
  4. Sorry, I didn’t read this article earlier, so I didn’t restart. Could you grant me WSGI Control Access? My username is talesaz, and my URL is talesaz.heliohost.us:https://talesaz.heliohost.us/bma.
  5. I am encountering an intermittent issue with my Flask application using Flask-SQLAlchemy. The application works for a while, but after refreshing the page a few times, it throws the following error: RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set. Error Context: The error appears in the Apache logs as follows: mod_wsgi (pid=3543435): Exception occurred processing WSGI script '/home/talesaz.heliohost.us/httpdocs/bma/flask.wsgi'. RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set. What I Have Tried: 1) Direct Configuration in config.py: I am not using .env files anymore. All configurations are directly set in config.py. 2) Database Connection Test: I added a test in run.py to check the database connection. 3) Error Handling: I added a generic error handler to capture unexpected exceptions. Behavior Observed: - The application works initially and connects to the database successfully. - After refreshing the page a few times, the error appears. - Refreshing the page again sometimes resolves the issue temporarily. - When running the application locally (on my machine) and connecting to the same MySQL database hosted on HelioHost, everything works perfectly without any issues. - The problem only occurs when the application is hosted directly on HelioHost.
  6. Hi guys, I’m getting a 500 Internal Server Error when running an application written in Python with Flask. Is there any tool on Heliohost that allows viewing logs or troubleshooting to identify the cause of the error? Thanks!
  7. Hi Guy, I need to install these Python requirements in my environment. Could you guide me through the process? Thanks! Flask==2.2.3 Flask-SQLAlchemy==3.1.1 SQLAlchemy==2.0.40 Flask-Login==0.6.2 Werkzeug==3.1.3 python-dotenv==1.0.0 blinker==1.9.0 Jinja2==3.1.6
×
×
  • Create New...