Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL_ALCHEMY_DATABASE_URI ignored from Apache mod_wsgi #3224

Closed
laranzu opened this issue Aug 2, 2017 · 6 comments
Closed

SQL_ALCHEMY_DATABASE_URI ignored from Apache mod_wsgi #3224

laranzu opened this issue Aug 2, 2017 · 6 comments

Comments

@laranzu
Copy link

laranzu commented Aug 2, 2017

Version: 0.18.5

Platform: Ubuntu 16.04 Apache 2.4

(Probably related to #3223)

I have superset pip installed into a virtualenv living at /usr/local/superset. My superset_config.py file has

SQLALCHEMY_DATABASE_URI = 'sqlite:////usr/local/superset/superset.db'

For this test I'm using AUTH_TYPE = AUTH_DB and have created an admin user with fabmanager.

Superset is being run from Apache via mod_wsgi. However it is ignoring the superset_config.py file and looking for /var/www/.superset/superset.db. If it can't find it, it creates a new empty database. Which makes it impossible to login.

@mistercrunch
Copy link
Member

You need to have a module named superset_config in your PYTHONPATH, meaning if yo fire up an interpreter and import superset_config it should work.

In production at Airbnb we drop that file (superset_config.py) into a specific folder, and run export PYTHONPATH=~/thatfolder.

As you fire up your web server you should see something like this:
screen shot 2017-08-01 at 9 14 41 pm

@laranzu
Copy link
Author

laranzu commented Aug 2, 2017

I do have a superset_config.py, it's in my PYTHONPATH. I know superset_config.py is being loaded when I do superset runserver.
But that's not the issue, I need it to work when run from Apache via mod_wsgi.
(And yes my virtualenv is being activated from Apache, because otherwise nothing would work at all.)

@mistercrunch
Copy link
Member

But is it in the Apache user's PYTHONPATH env?

@xrmx
Copy link
Contributor

xrmx commented Aug 2, 2017

@laranzu if you really need to use apache httpd you can use apache as http proxy for gunicorn, it may help making things easier to deploy for you.

@laranzu
Copy link
Author

laranzu commented Aug 2, 2017

My definition of "making things easier" would not be adding yet another layer of software (gunicorn) between Apache and Superset. Apache and WSGI have been around for many years because they work really well. I suggest that being able to deploy Superset "out of the box" in such systems is worth the effort.

Hacked around this issue for now.

@xrmx
Copy link
Contributor

xrmx commented Aug 3, 2017

My point is there's no issue to be worked around, it's just you are not passing the python path to httpd. Please open a PR to the doc with the proper httpd configuration to help other users with the same issue.

@laranzu laranzu closed this as completed Aug 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants