Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/333.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python apache flask sqlite无法在ubuntu上打开数据库文件_Python_Apache_Sqlite_Flask_Sqlalchemy - Fatal编程技术网

Python apache flask sqlite无法在ubuntu上打开数据库文件

Python apache flask sqlite无法在ubuntu上打开数据库文件,python,apache,sqlite,flask,sqlalchemy,Python,Apache,Sqlite,Flask,Sqlalchemy,首先,我尝试使用flask服务器运行应用程序,它运行得非常完美 这是错误日志 [Mon Jan 06 08:57:53.680218 2020] [mpm_event:notice] [pid 3499:tid 139791901608896] AH00491: caught SIGTERM, shutting down [Mon Jan 06 08:57:53.733321 2020] [mpm_event:notice] [pid 3572:tid 140391160454080] AH00

首先,我尝试使用flask服务器运行应用程序,它运行得非常完美 这是错误日志

[Mon Jan 06 08:57:53.680218 2020] [mpm_event:notice] [pid 3499:tid 139791901608896] AH00491: caught SIGTERM, shutting down
[Mon Jan 06 08:57:53.733321 2020] [mpm_event:notice] [pid 3572:tid 140391160454080] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/2.7 configured -- resuming normal operations
[Mon Jan 06 08:57:53.733463 2020] [core:notice] [pid 3572:tid 140391160454080] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jan 06 08:57:55.712042 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141] mod_wsgi (pid=3573): Target WSGI script '/var/www/FlaskApp/flaskapp.wsgi' cannot be loaded as Python module.
[Mon Jan 06 08:57:55.712087 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141] mod_wsgi (pid=3573): Exception occurred processing WSGI script '/var/www/FlaskApp/flaskapp.wsgi'.
[Mon Jan 06 08:57:55.712124 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141] Traceback (most recent call last):
[Mon Jan 06 08:57:55.712141 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/var/www/FlaskApp/flaskapp.wsgi", line 10, in <module>
[Mon Jan 06 08:57:55.712191 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     from FlaskApp import app as application
[Mon Jan 06 08:57:55.712206 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/var/www/FlaskApp/FlaskApp/__init__.py", line 9, in <module>
[Mon Jan 06 08:57:55.712339 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     from database_setup import Department, Base, Req_Status, Req_Priorities, Time_Units, Req_Type, Requests, User
[Mon Jan 06 08:57:55.712367 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/var/www/FlaskApp/FlaskApp/database_setup.py", line 77, in <module>
[Mon Jan 06 08:57:55.712440 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     Base.metadata.create_all(engine)
[Mon Jan 06 08:57:55.712454 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/schema.py", line 4316, in create_all
[Mon Jan 06 08:57:55.713290 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     ddl.SchemaGenerator, self, checkfirst=checkfirst, tables=tables
[Mon Jan 06 08:57:55.713307 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2048, in _run_visitor
[Mon Jan 06 08:57:55.713698 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     with self._optional_conn_ctx_manager(connection) as conn:
[Mon Jan 06 08:57:55.713711 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
[Mon Jan 06 08:57:55.713758 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     return self.gen.next()
[Mon Jan 06 08:57:55.713768 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2040, in _optional_conn_ctx_manager
[Mon Jan 06 08:57:55.713781 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     with self._contextual_connect() as conn:
[Mon Jan 06 08:57:55.713803 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2242, in _contextual_connect
[Mon Jan 06 08:57:55.713814 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     self._wrap_pool_connect(self.pool.connect, None),
[Mon Jan 06 08:57:55.713821 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2280, in _wrap_pool_connect
[Mon Jan 06 08:57:55.713831 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     e, dialect, self
[Mon Jan 06 08:57:55.713839 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1547, in _handle_dbapi_exception_noconnection
[Mon Jan 06 08:57:55.713848 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     util.raise_from_cause(sqlalchemy_exception, exc_info)
[Mon Jan 06 08:57:55.713856 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 398, in raise_from_cause
[Mon Jan 06 08:57:55.713968 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     reraise(type(exception), exception, tb=exc_tb, cause=cause)
[Mon Jan 06 08:57:55.713977 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2276, in _wrap_pool_connect
[Mon Jan 06 08:57:55.713987 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     return fn()
[Mon Jan 06 08:57:55.713995 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool/base.py", line 363, in connect
[Mon Jan 06 08:57:55.714163 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     return _ConnectionFairy._checkout(self)
[Mon Jan 06 08:57:55.714181 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool/base.py", line 760, in _checkout
[Mon Jan 06 08:57:55.714193 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     fairy = _ConnectionRecord.checkout(pool)
[Mon Jan 06 08:57:55.714200 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool/base.py", line 492, in checkout
[Mon Jan 06 08:57:55.714209 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     rec = pool._do_get()
[Mon Jan 06 08:57:55.714216 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool/impl.py", line 238, in _do_get
[Mon Jan 06 08:57:55.714303 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     return self._create_connection()
[Mon Jan 06 08:57:55.714312 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool/base.py", line 308, in _create_connection
[Mon Jan 06 08:57:55.714323 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     return _ConnectionRecord(self)
[Mon Jan 06 08:57:55.714330 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool/base.py", line 437, in __init__
[Mon Jan 06 08:57:55.714339 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     self.__connect(first_connect_check=True)
[Mon Jan 06 08:57:55.714346 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool/base.py", line 639, in __connect
[Mon Jan 06 08:57:55.714355 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     connection = pool._invoke_creator(self)
[Mon Jan 06 08:57:55.714362 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/strategies.py", line 114, in connect
[Mon Jan 06 08:57:55.714431 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     return dialect.connect(*cargs, **cparams)
[Mon Jan 06 08:57:55.714440 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 482, in connect
[Mon Jan 06 08:57:55.714691 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141]     return self.dbapi.connect(*cargs, **cparams)
[Mon Jan 06 08:57:55.714736 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141] OperationalError: (sqlite3.OperationalError) unable to open database file
[Mon Jan 06 08:57:55.714742 2020] [wsgi:error] [pid 3573:tid 140391057372928] [client 10.10.30.35:59141] (Background on this error at: http://sqlalche.me/e/e3q8)
[Mon Jan 06 08:57:55.852806 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142] mod_wsgi (pid=3573): Target WSGI script '/var/www/FlaskApp/flaskapp.wsgi' cannot be loaded as Python module., referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.852847 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142] mod_wsgi (pid=3573): Exception occurred processing WSGI script '/var/www/FlaskApp/flaskapp.wsgi'., referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.852904 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142] Traceback (most recent call last):, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.852949 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/var/www/FlaskApp/flaskapp.wsgi", line 10, in <module>, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.852991 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     from FlaskApp import app as application, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853011 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/var/www/FlaskApp/FlaskApp/__init__.py", line 9, in <module>, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853026 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     from database_setup import Department, Base, Req_Status, Req_Priorities, Time_Units, Req_Type, Requests, User, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853034 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/var/www/FlaskApp/FlaskApp/database_setup.py", line 77, in <module>, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853046 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     Base.metadata.create_all(engine), referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853053 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/schema.py", line 4316, in create_all, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853066 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     ddl.SchemaGenerator, self, checkfirst=checkfirst, tables=tables, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853074 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2048, in _run_visitor, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853085 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     with self._optional_conn_ctx_manager(connection) as conn:, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853092 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853102 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     return self.gen.next(), referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853109 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2040, in _optional_conn_ctx_manager, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853118 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     with self._contextual_connect() as conn:, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853125 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2242, in _contextual_connect, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853135 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     self._wrap_pool_connect(self.pool.connect, None),, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853141 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2280, in _wrap_pool_connect, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853151 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     e, dialect, self, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853157 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1547, in _handle_dbapi_exception_noconnection, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853167 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     util.raise_from_cause(sqlalchemy_exception, exc_info), referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853174 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 398, in raise_from_cause, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853191 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     reraise(type(exception), exception, tb=exc_tb, cause=cause), referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853198 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2276, in _wrap_pool_connect, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853208 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     return fn(), referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853215 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool/base.py", line 363, in connect, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853226 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     return _ConnectionFairy._checkout(self), referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853232 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool/base.py", line 760, in _checkout, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853242 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     fairy = _ConnectionRecord.checkout(pool), referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853249 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool/base.py", line 492, in checkout, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853258 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     rec = pool._do_get(), referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853265 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool/impl.py", line 238, in _do_get, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853275 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     return self._create_connection(), referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853282 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool/base.py", line 308, in _create_connection, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853291 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     return _ConnectionRecord(self), referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853298 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool/base.py", line 437, in __init__, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853307 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     self.__connect(first_connect_check=True), referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853314 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool/base.py", line 639, in __connect, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853323 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     connection = pool._invoke_creator(self), referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853329 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/strategies.py", line 114, in connect, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853339 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     return dialect.connect(*cargs, **cparams), referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853346 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 482, in connect, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853360 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142]     return self.dbapi.connect(*cargs, **cparams), referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853390 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142] OperationalError: (sqlite3.OperationalError) unable to open database file, referer: http://10.10.30.99/
[Mon Jan 06 08:57:55.853395 2020] [wsgi:error] [pid 3573:tid 140391040587520] [client 10.10.30.35:59142] (Background on this error at: http://sqlalche.me/e/e3q8), referer: http://10.10.30.99/

我的文件hierarchyin/var/www/is

  • 烧瓶
    • flaskapp.wsgi
    • 烧瓶
      • 静止的
      • 模板
      • 文夫
      • init.py
      • 数据库设置
      • IT_DataBase.db
这是flaskapp.wsgi中的配置

#!/usr/bin/python                                                                
activate_this = '/var/www/FlaskApp/FlaskApp/venv/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))

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

from FlaskApp import app as application
application.secret_key = 'super_secret_key!'
这是apache的FlaskApp.conf

<VirtualHost *:80>
        ServerName mywebsite.com
        ServerAdmin admin@mywebsite.com
        WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi
        <Directory /var/www/FlaskApp/FlaskApp/>
            Order allow,deny
            Allow from all
        </Directory>
        Alias /static /var/www/FlaskApp/FlaskApp/static
        <Directory /var/www/FlaskApp/FlaskApp/static/>
            Order allow,deny
            Allow from all
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

服务器名mywebsite.com
服务器管理员admin@mywebsite.com
WSGIScriptAlias//var/www/FlaskApp/FlaskApp.wsgi
命令允许,拒绝
通融
别名/static/var/www/FlaskApp/FlaskApp/static
命令允许,拒绝
通融
ErrorLog${APACHE_LOG_DIR}/error.LOG
日志级别警告
CustomLog${APACHE\u LOG\u DIR}/access.LOG组合
(编辑)
当我尝试运行python flaskapp.wsgi时,它给出了相同的错误

问题通过赋予www数据所有权并从数据库设置中删除几行来解决

这里的一些答案似乎值得检查:尝试了解决方案并将所有者更改为www数据,并给予.db文件777权限,但同样的问题哦,这不是一个正确的解决方案,允许系统中的每个人读写您的数据库不是最优的,至少从长远来看是如此。我知道,我只想让它在apache上工作,至少现在是这样
<VirtualHost *:80>
        ServerName mywebsite.com
        ServerAdmin admin@mywebsite.com
        WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi
        <Directory /var/www/FlaskApp/FlaskApp/>
            Order allow,deny
            Allow from all
        </Directory>
        Alias /static /var/www/FlaskApp/FlaskApp/static
        <Directory /var/www/FlaskApp/FlaskApp/static/>
            Order allow,deny
            Allow from all
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>