mirror of
https://github.com/LukeHagar/pypistats.org.git
synced 2025-12-06 04:21:09 +00:00
env bugfix
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,7 @@
|
||||
# credentials
|
||||
secret.*
|
||||
env_vars*
|
||||
*.env
|
||||
|
||||
# mac osx
|
||||
.DS_Store
|
||||
|
||||
@@ -2,6 +2,7 @@ FROM python:3.6-slim
|
||||
|
||||
ADD requirements.txt requirements.txt
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
ADD . .
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
@@ -11,9 +11,8 @@ services:
|
||||
flask:
|
||||
build: .
|
||||
restart: always
|
||||
environment:
|
||||
- FLASK_APP=pypistats/run.py
|
||||
- ENV=prod
|
||||
env_file:
|
||||
- pypistats/secret/prod.env
|
||||
command: 'flask run --host=0.0.0.0'
|
||||
ports:
|
||||
- '5000:5000'
|
||||
@@ -21,6 +20,8 @@ services:
|
||||
celery:
|
||||
build: .
|
||||
restart: always
|
||||
env_file:
|
||||
- pypistats/secret/prod.env
|
||||
command: 'celery -A pypistats.run.celery worker -l info'
|
||||
user: nobody
|
||||
depends_on:
|
||||
@@ -29,6 +30,8 @@ services:
|
||||
beat:
|
||||
build: .
|
||||
restart: always
|
||||
command: 'celery beat -A pypistats.run.celery -l info'
|
||||
env_file:
|
||||
- pypistats/secret/prod.env
|
||||
command: 'celery beat -A pypistats.run.celery -l info --pidfile='
|
||||
depends_on:
|
||||
- redis
|
||||
|
||||
@@ -22,7 +22,6 @@ def create_app(config_object=DevConfig):
|
||||
def create_celery(app):
|
||||
"""Create a celery object."""
|
||||
celery = Celery(app.import_name, broker=app.config["CELERY_BROKER_URL"])
|
||||
celery.conf.update(app.config)
|
||||
celery.config_from_object(app.config)
|
||||
|
||||
class ContextTask(Task):
|
||||
|
||||
@@ -11,12 +11,13 @@ from pypistats.settings import configs
|
||||
|
||||
|
||||
# change this for migrations
|
||||
env = os.environ.get("ENV", "dev")
|
||||
env = os.environ.get("ENV", "prod")
|
||||
|
||||
print(env)
|
||||
app = create_app(configs[env])
|
||||
celery = create_celery(app)
|
||||
|
||||
app.logger.info(f"Environment: {env}")
|
||||
|
||||
|
||||
@app.before_request
|
||||
def before_request():
|
||||
|
||||
Reference in New Issue
Block a user