Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

377
Views
This connection is using {tls_version} which is now, unable to deploy Flask application on Linux

I am posting my first question here, so please let me know if I can improve my skills regarding asking a question here.

I am deploying a python application on a linux-server which will receive a JSON payload and write to a mariadb database, I have successfully tested the application on pycharm while connecting it to the same database remotely. It only gives error when I run it on the server, below is the error console:

**export FLASK_APP=testapp.py
$ python3 -m flask run**

    Traceback (most recent call last):
      File "/usr/lib/python3.5/runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/usr/lib/python3/dist-packages/flask/__main__.py", line 15, in <module>
        main(as_module=True)
      File "/usr/lib/python3/dist-packages/flask/cli.py", line 513, in main
        cli.main(args=args, prog_name=name)
      File "/usr/lib/python3/dist-packages/flask/cli.py", line 380, in main
        return AppGroup.main(self, *args, **kwargs)
      File "/usr/lib/python3/dist-packages/click/core.py", line 696, in main
        rv = self.invoke(ctx)
      File "/usr/lib/python3/dist-packages/click/core.py", line 1060, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/usr/lib/python3/dist-packages/click/core.py", line 889, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/usr/lib/python3/dist-packages/click/core.py", line 534, in invoke
        return callback(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/click/decorators.py", line 64, in new_func
        return ctx.invoke(f, obj, *args[1:], **kwargs)
      File "/usr/lib/python3/dist-packages/click/core.py", line 534, in invoke
        return callback(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/flask/cli.py", line 423, in run_command
        app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
      File "/usr/lib/python3/dist-packages/flask/cli.py", line 152, in __init__
        self._load_unlocked()
      File "/usr/lib/python3/dist-packages/flask/cli.py", line 176, in _load_unlocked
        self._app = rv = self.loader()
      File "/usr/lib/python3/dist-packages/flask/cli.py", line 237, in load_app
        rv = locate_app(self.app_import_path)
      File "/usr/lib/python3/dist-packages/flask/cli.py", line 90, in locate_app
        __import__(module)
      File "/home/573076.cloudwaysapps.com/csthybvwhm/public_html/testapp.py", line 7, in <module>
        import mysql.connector as database
      File "/home/master/.local/lib/python3.5/site-packages/mysql/connector/__init__.py", line 53, in <module>
        from .connection import MySQLConnection
      File "/home/master/.local/lib/python3.5/site-packages/mysql/connector/connection.py", line 442
        f"This connection is using {tls_version} which is now "
                                                              ^

My SQL connection config mentioned below:

import mysql.connector as database

connection = database.connect(
               user="username",
               password="password",
               host="localhost",
               database="database",
               port="3306"

             )

             cursor = connection.cursor()
             add_user = """INSERT INTO database.tablename
             (time, name,email, admin, id, team, remarks) 
             VALUES (%s,%s,%s,%s,%s,%s,%s)"""
             data_user = (name, email, id, team, remarks)
             cursor.execute(add_user, data_user)
             connection.commit()
             cursor.close()
             connection.close()
             print("Successfully added entry to database")

I have tried disabling SSL for my SQL server, wanted to try to push tls_version via MySQL config in python but there is no valid argument for me to do so.

Any help or insights are most welcome, thank you in advance. This platform is the reason I have learned this far. :)

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Compare the openssl versions on your pycharm machine, linux server and db server (using openssl version) you might need to upgrade some of them. You can check more on which version supports what protocol in the openssl changelog.

over 4 years ago · Santiago Trujillo Report

0

This is beautifully answered by Rishi, here: ImportError: No module named 'MySQL'

It looks like I had to install the right mysql.connector package, verified and ran the application.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!