Cayenne
Cayenne

Reputation: 94

Apache showing Permission denied: flask_session error

Im trying to get flask with virtual environment and wsgi configured to work but Apache keeps giving me this error:

[Tue Nov 13 13:23:55.179153 2018] [wsgi:error] [pid 11819] [x.x.x.x:xxxx] app.session_interface = self._get_interface(app)

[Tue Nov 13 13:23:55.179160 2018] [wsgi:error] [pid 11819] [x.x.x.x:xxxx] File "/var/www/html/project/python/lib/python3.6/site-packages/flask_session/init.py", line 93, in _get_interface

[Tue Nov 13 13:23:55.179163 2018] [wsgi:error] [pid 11819] [x.x.x.x:xxxx] config['SESSION_USE_SIGNER'], config['SESSION_PERMANENT'])

[Tue Nov 13 13:23:55.179169 2018] [wsgi:error] [pid 11819] [x.x.x.x:xxxx] File "/var/www/html/project/python/lib/python3.6/site-packages/flask_session/sessions.py", line 314, in init

[Tue Nov 13 13:23:55.179172 2018] [wsgi:error] [pid 11819] [x.x.x.x:xxxx] self.cache = FileSystemCache(cache_dir, threshold=threshold, mode=mode)

[Tue Nov 13 13:23:55.179177 2018] [wsgi:error] [pid 11819] [x.x.x.x:xxxx] File "/var/www/html/project/python/lib/python3.6/site-packages/werkzeug/contrib/cache.py", line 717, in init

[Tue Nov 13 13:23:55.179180 2018] [wsgi:error] [pid 11819] [x.x.x.x:xxxx] os.makedirs(self._path)

[Tue Nov 13 13:23:55.179185 2018] [wsgi:error] [pid 11819] [x.x.x.x:xxxx] File "/lib64/python3.6/os.py", line 220, in makedirs

[Tue Nov 13 13:23:55.179188 2018] [wsgi:error] [pid 11819] [x.x.x.x:xxxx] mkdir(name, mode)

[Tue Nov 13 13:23:55.179215 2018] [wsgi:error] [pid 11819] [x.x.x.x:xxxx] PermissionError: [Errno 13] Permission denied: '/flask_session'

I tried giving the project different permissions but nothing worked

Upvotes: 3

Views: 2141

Answers (2)

Sab
Sab

Reputation: 61

You should specify which type of session interface to use.

Try to set the SESSION-TYPE to "null".

Upvotes: 0

Dave W. Smith
Dave W. Smith

Reputation: 24966

The directory is failing to be created is on behalf of flask-session, which has a SESSION_FILE_DIR setting that'll let you override its default. Point that to some place with the appropriate permissions, and you'll likely be fine.

Upvotes: 1

Related Questions