Use config.py for rqsettings

Move `config.local.py` to `config_local.py`, since `.` is invalid in
filenames for imports
This commit is contained in:
Max Meinhold 2020-10-11 13:28:05 -04:00
parent c80b240497
commit b95e446857
No known key found for this signature in database
GPG key ID: 00B8B1017EEC103F
3 changed files with 10 additions and 4 deletions

View file

@ -18,8 +18,9 @@ It is available to house members at [proxstar.csh.rit.edu](https://proxstar.csh.
1. [Fork](https://help.github.com/en/articles/fork-a-repo) this repository
- Optionally create a new [git branch](https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell) if your change is more than a small tweak (`git checkout -b BRANCH-NAME-HERE`)
3. Make your changes locally, commit, and push to your fork
- If you want to test locally, you should copy `config.py` to `config_local.py`, and talk to an RTP about filling in secrets.
4. Create a [Pull Request](https://help.github.com/en/articles/about-pull-requests) on this repo for our Webmasters to review
## Questions/Concerns
Please file an [Issue](https://github.com/ComputerScienceHouse/proxstar/issues/new) on this repository.
Please file an [Issue](https://github.com/ComputerScienceHouse/proxstar/issues/new) on this repository.

View file

@ -35,9 +35,9 @@ app = Flask(__name__)
app.config.from_object(rq_dashboard.default_settings)
if os.path.exists(
os.path.join(
app.config.get('ROOT_DIR', os.getcwd()), 'config.local.py')):
app.config.get('ROOT_DIR', os.getcwd()), 'config_local.py')):
config = os.path.join(
app.config.get('ROOT_DIR', os.getcwd()), 'config.local.py')
app.config.get('ROOT_DIR', os.getcwd()), 'config_local.py')
else:
config = os.path.join(app.config.get('ROOT_DIR', os.getcwd()), 'config.py')
app.config.from_pyfile(config)

View file

@ -3,7 +3,12 @@ import os
import sentry_sdk
from sentry_sdk.integrations.rq import RqIntegration
if os.path.exists('config_local.py'):
import config_local as config
else:
import config
sentry_sdk.init(
os.environ.get('PROXSTAR_SENTRY_DSN'),
config.SENTRY_DSN,
integrations=[RqIntegration()]
)