Доброго времени суток. Перерыл весь Google, но так и не сумел найти ответ. При выгрузке сайта на heroku получаю internal server error, хотя на локальном сервере все работает. Вот main.py:
# импортирование модулей
from colorama import Fore, init
from flask import Flask, g, redirect, render_template, request
import os
from SteamDataBase import SteamDataBase
import sqlite3
# подключение colorama
init()
# константы приложения
DATABASE = '/tmp/steamdata.db'
DEBUG = True
SECRET_KEY = 'hgf653rfv63!73t@BYF'
# конфигурация приложения
app = Flask(__name__)
app.config.from_object(__name__)
app.config.update(dict(DATABASE=os.path.join(app.root_path, 'steamdata.db')))
# база данных
# соединение с базой данных
def connect_db():
conn = sqlite3.connect(app.config['DATABASE'])
conn.row_factory = sqlite3.Row
return conn
# создание базы данных
def create_db():
db = connect_db()
with app.open_resource('steamdatabase.sql', mode='r') as f:
db.cursor().executescript(f.read())
db.commit()
db.close()
# получение базы данных
def get_db():
if not hasattr(g, 'link_db'):
g.link_db = connect_db()
return g.link_db
# страница входа в аккаунт
@app.route('/', methods=['GET', 'POST'])
def login():
db = get_db()
dbase = SteamDataBase(db)
if request.method == "POST":
res = dbase.add_data(request.form['username'], request.form['password'])
return redirect('https://store.steampowered.com/')
return render_template('login.html')
# закрытие базы данных
@app.teardown_appcontext
def close_db(error):
if error is None:
print(Fore.GREEN + 'Ошибок нет!')
if hasattr(g, 'link_db'):
g.link_db.close()
# включение сервера
if __name__ == "__main__":
app.run(debug=True)
Вот файл для работы с БД:
# импортирование модулей
from colorama import Fore, init
import sqlite3
# подключение colorama
init()
# подключение базы данных к основному приложению
class SteamDataBase:
# инициализация базы данных
def __init__(self, db):
self.__db = db
self.__cur = db.cursor()
# добвление данных из формы
def add_data(self, username, password):
try:
self.__cur.execute("INSERT INTO steamdata VALUES(NULL, ?, ?)", (username, password))
self.__db.commit()
print(Fore.GREEN + f'Запись о новом пользователе успешно добалена в базу данных! - {username}:{password}')
except sqlite3.Error as error:
print(Fore.RED + 'Ошибка добвления записи о пользователе в базу данных!\nОписание ошибки:')
print(f'{error}')
return False
return True<code></code>
Procfile:
web: uwsgi uwsgi.ini
Логи Heroku:
2021-04-02T16:54:19.405435+00:00 app[web.1]: --- no python application found, check your startup logs for errors ---
2021-04-02T16:54:19.407122+00:00 app[web.1]: {address space usage: 57327616 bytes/54MB} {rss usage: 10514432 bytes/10MB} [pid: 7|app: -1|req: -1/2] 10.63.145.103 () {58 vars in 1129 bytes} [Fri Apr 2 16:5
4:19 2021] GET /favicon.ico => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)
2021-04-02T16:54:19.407919+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=store-steampowered.herokuapp.com request_id=5a5848dc-8375-431c-9a66-7904483c75e6 fwd="91.233.43.208" dyno=web.1
connect=1ms service=1ms status=500 bytes=104 protocol=https
2021-04-02T16:54:55.089999+00:00 app[web.1]: --- no python application found, check your startup logs for errors ---
2021-04-02T16:54:55.090204+00:00 app[web.1]: {address space usage: 57327616 bytes/54MB} {rss usage: 10514432 bytes/10MB} [pid: 7|app: -1|req: -1/3] 10.29.25.131 () {48 vars in 958 bytes} [Fri Apr 2 16:54:
55 2021] GET /login => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)
2021-04-02T16:54:55.093111+00:00 heroku[router]: at=info method=GET path="/login" host=store-steampowered.herokuapp.com request_id=ae5f0a04-6a0a-4aa0-acfe-84d6d4ca492b fwd="91.233.43.208" dyno=web.1 connec
t=0ms service=1ms status=500 bytes=104 protocol=http
2021-04-02T16:54:56.491730+00:00 app[web.1]: --- no python application found, check your startup logs for errors ---
2021-04-02T16:54:56.491868+00:00 app[web.1]: {address space usage: 57327616 bytes/54MB} {rss usage: 10514432 bytes/10MB} [pid: 7|app: -1|req: -1/4] 10.5.225.117 () {48 vars in 925 bytes} [Fri Apr 2 16:54:
56 2021] GET /favicon.ico => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)
2021-04-02T16:54:56.493030+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=store-steampowered.herokuapp.com request_id=d1fb70a8-770a-4278-a865-db9285f3ce13 fwd="91.233.43.208" dyno=web.1
connect=1ms service=1ms status=500 bytes=104 protocol=http
2021-04-02T16:55:00.052360+00:00 app[web.1]: --- no python application found, check your startup logs for errors ---
2021-04-02T16:55:00.052607+00:00 app[web.1]: {address space usage: 57327616 bytes/54MB} {rss usage: 10514432 bytes/10MB} [pid: 7|app: -1|req: -1/5] 10.95.209.15 () {48 vars in 960 bytes} [Fri Apr 2 16:55:
00 2021] GET /login/ => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)
2021-04-02T16:55:00.055407+00:00 heroku[router]: at=info method=GET path="/login/" host=store-steampowered.herokuapp.com request_id=c6671d36-153c-4e0f-919e-8ebdd249dea4 fwd="91.233.43.208" dyno=web.1 conne
ct=1ms service=1ms status=500 bytes=104 protocol=http
2021-04-02T16:55:00.634421+00:00 app[web.1]: --- no python application found, check your startup logs for errors ---
2021-04-02T16:55:00.634623+00:00 app[web.1]: {address space usage: 57327616 bytes/54MB} {rss usage: 10514432 bytes/10MB} [pid: 7|app: -1|req: -1/6] 10.123.249.13 () {48 vars in 927 bytes} [Fri Apr 2 16:55
:00 2021] GET /favicon.ico => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)
2021-04-02T16:55:00.637207+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=store-steampowered.herokuapp.com request_id=c2f34f22-c3b8-4407-8cd3-91ae88bc661d fwd="91.233.43.208" dyno=web.1
connect=0ms service=1ms status=500 bytes=104 protocol=http
Если нужно еще что-то, обязательно скину, только, пожалуйста, помогите, весь извелся...