Category : flask

I have a problem. I want to delete row from mysql table. I don’t understand what is wrong. Application return error only production linux enviroment, on Windows everything is okay. def sql_execute(conn, sql, val): try: cursor = conn.cursor() cursor.execute(sql, val) conn.commit() except mysql.connector.Error as e: print("sql_insert: ", info.error_insert_info, e) def delete_type_for_id(conn, val): sql = "DELETE ..

Read more

I need help uploading a file directly from an HTML form to an API. I’ve seen this being done for remote URLs, but I don’t know how to do this for local files? I tried writing this, but its not working: uploadmedia = request.files[‘fileupload’] client = Client(‘thisismykey’) with open(uploadmedia, ‘rb’) as file: new_upload = client.uploads(‘<space-id>’).create(file) ..

Read more

I’m Doing the tutorial (https://www.youtube.com/watch?v=dam0GPOAvVI&t=2412s) it was working nicely since there was a problem I don’t what.When I run the main.py Traceback (most recent call last): File "c:UsersadminDocumentsFlaskmain.py", line 6, in <module> app.run(debug=True) AttributeError: ‘NoneType’ object has no attribute ‘run’ PS C:UsersadminDocumentsFlask> And the website isn’t comming This site can’t be reached 127.0.0.1 refused to ..

Read more

from flask import Flask, jsonify from flask import request from slotscal import results from flask_sqlalchemy import SQLAlchemy import time app = Flask(__name__) app.config[‘SQLALCHEMY_DATABASE_URI’]= ‘postgresql://postgres:[email protected]:5432/flask’ db=SQLAlchemy(app) Traceback (most recent call last): File "", line 1, in File "/home/hamza/.local/lib/python3.8/site-packages/flask_sqlalchemy/init.py", line 1094, in create_all self._execute_for_all_tables(app, bind, ‘create_all’) File "/home/hamza/.local/lib/python3.8/site-packages/flask_sqlalchemy/init.py", line 1086, in _execute_for_all_tables op(bind=self.get_engine(app, bind), **extra) File "/home/hamza/.local/lib/python3.8/site-packages/flask_sqlalchemy/init.py", ..

Read more