1

first of all i tried to run the app using the flask server and it runs perfectly this is the error log

[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/

my connection String in init.py is

from flask import Flask, render_template, request, redirect, url_for, flash
from flask_bootstrap import Bootstrap
from flask_wtf import FlaskForm 
from wtforms import StringField, PasswordField, BooleanField
from wtforms.validators import InputRequired, Email, Length
from flask_sqlalchemy  import SQLAlchemy
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import LoginManager, UserMixin, login_user, login_required, logout_user, current_user
from database_setup import Department, Base, Req_Status, Req_Priorities, Time_Units, Req_Type, Requests, User
from sqlalchemy import create_engine, asc
from sqlalchemy.orm import sessionmaker
from flask import session as Session
from flask_table import Table, Col
from sqlalchemy import desc
from flask_wtf import Form
from wtforms.fields.html5 import DateField
from datetime import datetime
from datetime import timedelta
from sqlalchemy import exc
import random
import time
app = Flask(__name__)
bootstrap = Bootstrap(app)
engine = create_engine('sqlite:////var/www/FlaskApp/FlaskApp/IT_DataBase.db',
                       connect_args={'check_same_thread': False,'timeout': 15})
Base.metadata.bind = engine
DBSession = sessionmaker(bind=engine)
session = DBSession()
db = SQLAlchemy(app)

my file hierarchyin /var/www/ is

  • FlaskApp
    • flaskapp.wsgi
    • FlaskApp
      • static
      • templates
      • venv
      • init.py
      • database_setup
      • IT_DataBase.db

this is the config in 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!'

and this is apache's FlaskApp.conf

<VirtualHost *:80>
        ServerName mywebsite.com
        ServerAdmin [email protected]
        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>

(Edit) i when i try to run python flaskapp.wsgi it gives the same error

4
  • Some of the answers here seem worth checking: stackoverflow.com/questions/7670289/… Commented Jan 6, 2020 at 8:42
  • tried the solutions and changed owner to www-data and gave .db file 777 permission but same problem Commented Jan 6, 2020 at 9:14
  • Oh, that's not a proper solution though, allowing everyone in the system to read and write to your DB is not optimal, at least in the long run. Commented Jan 6, 2020 at 9:26
  • i knpow, i just wanna make it work on apache, for now at lease Commented Jan 6, 2020 at 9:38

1 Answer 1

0

problem solved by giving ownership to www-data and removing few lines from database setup

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.