sqlalchemy.exc.OperationalError:(sqlite3.OperationalError)无法打开数据库文件apache flask应用程序

时间:2019-10-24 05:06:39

标签: python apache sqlite wsgi

我有一个服务器,要在其上运行烧瓶应用程序,这是烧瓶的主要代码

from flask import Flask, render_template, request
from flask import redirect, jsonify, url_for, flash
from sqlalchemy import create_engine, asc
from sqlalchemy.orm import sessionmaker
from database_setup import User, Base, Category, Item
from flask import session as login_session
import random
import string
from oauth2client.client import flow_from_clientsecrets
from oauth2client.client import FlowExchangeError
import httplib2
import json
from flask import make_response
import requests

app = Flask(__name__)

CLIENT_ID = json.loads(
   open('client_secrets.json', 'r').read())['web']['client_id']
APPLICATION_NAME = "Item Catalog Application"


# Connect to Database and create database session
engine = create_engine('sqlite:///itemcat.db',
                      connect_args={'check_same_thread': False})
Base.metadata.bind = engine

DBSession = sessionmaker(bind=engine)
session = DBSession()

这是wsgi代码

import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,'/var/www/Catalog/')

from App import app as application
application.secret_key = 'super_secret_key'

这是配置文件

WSGIScriptAlias / /var/www/App.wsgi

如果我使用以下命令运行App.py python app.py可以完美运行

但是如果我使用wsgi文件或使用apache运行它,则会显示sqlite无法打开db文件的错误 this is the tree structure

0 个答案:

没有答案