Browse Source

app: production updates

Nikola Kotur 10 years ago
parent
commit
33f282c638
4 changed files with 22 additions and 15 deletions
  1. 7 3
      conf/development.cfg
  2. 12 9
      conf/production.cfg
  3. 1 1
      db_repository/manage.py
  4. 2 2
      db_repository/migrate.cfg

+ 7 - 3
conf/development.cfg

@@ -1,27 +1,31 @@
-
 SECRET_KEY = "\xb0k\xd0\x03\xd9\x0b*\xa0UE\x80\x93BbIT\xa3\xe6\xef\x7fq\xf2\xf9F"
-
 PORT = 8000
 
 # Debugging.
 DEBUG = True
 DEBUG_TB_INTERCEPT_REDIRECTS = False
 
+# Phosic settings.
 PHOSIC_STAT_MINUTES = 1
+PHOSIC_CLEAN_HOURS = 1
 PHOSIC_TASK_DELAY = 1
 PHOSIC_TASK_MAX_EXECUTION_TIME = 600
 PHOSIC_JOB_EXPIRY_MINUTES = 30
 
+# Upload settings.
 UPLOAD_FOLDER = "/home/kotnik/code/snakepit/phosic/phosic/uploads"
 MAX_CONTENT_LENGTH = 16777216
 
+# Recaptcha.
 RECAPTCHA_USE_SSL = False
 RECAPTCHA_PUBLIC_KEY = "6LcrufQSAAAAALwUQKlvx2YKvMIQZ1mabsOgxTJR"
 RECAPTCHA_PRIVATE_KEY = "6LcrufQSAAAAAEfnYns8o-LPGjlD0s6u6veYWEc0"
 
+# Database.
 SQLALCHEMY_DATABASE_URI = "sqlite:////home/kotnik/code/snakepit/phosic/phosic/app.db"
 SQLALCHEMY_MIGRATE_REPO = "/home/kotnik/code/snakepit/phosic/phosic/db_repository"
 
+# Celery.
 from celery.schedules import crontab
 CELERY_BROKER_URL = "amqp://phosic:phosic@lab//"
 CELERY_RESULT_BACKEND = "amqp://phosic:phosic@lab//"
@@ -36,6 +40,6 @@ CELERYBEAT_SCHEDULE = {
     },
     'cleaner': {
         'task': 'phosic.tasks.delete_expired',
-        'schedule': crontab(hour='*/1'),
+        'schedule': crontab(hour='*/%s' % PHOSIC_CLEAN_HOURS),
     },
 }

+ 12 - 9
conf/production.cfg

@@ -1,30 +1,33 @@
-
 SECRET_KEY = "\xb0k\xd0\x03\xd9\x0b*\xa0UE\x80\x93BbIT\xa3\xe6\xef\x7fq\xf2\xf9F"
 
-PORT = 8000
-
 # Debugging.
-DEBUG = True
+DEBUG = False
 DEBUG_TB_INTERCEPT_REDIRECTS = False
 
+# Phosic settings.
 PHOSIC_STAT_MINUTES = 10
+PHOSIC_CLEAN_HOURS = 1
 PHOSIC_TASK_DELAY = 30
 PHOSIC_TASK_MAX_EXECUTION_TIME = 600
 PHOSIC_JOB_EXPIRY_MINUTES = 3600
 
+# Upload settings.
 UPLOAD_FOLDER = "/home/kotnik/code/snakepit/phosic/phosic/uploads"
 MAX_CONTENT_LENGTH = 16777216
 
+# Recaptcha.
 RECAPTCHA_USE_SSL = False
 RECAPTCHA_PUBLIC_KEY = "6LdjB_USAAAAABkkFMXtPfySe2ZwMKBrI5nxPIEi"
 RECAPTCHA_PRIVATE_KEY = "6LdjB_USAAAAAH-fTfjhp5sAJI_mRJYHYVAcxiMc"
 
-SQLALCHEMY_DATABASE_URI = "sqlite:////home/kotnik/code/snakepit/phosic/phosic/app.db"
-SQLALCHEMY_MIGRATE_REPO = "/home/kotnik/code/snakepit/phosic/phosic/db_repository"
+# Database.
+SQLALCHEMY_DATABASE_URI = "sqlite:////home/phosic/phosic-web/app.db"
+SQLALCHEMY_MIGRATE_REPO = "/home/phosic/phosic-web/db_repository"
 
+# Celery.
 from celery.schedules import crontab
-CELERY_BROKER_URL = "amqp://phosic:phosic@lab//"
-CELERY_RESULT_BACKEND = "amqp://phosic:phosic@lab//"
+CELERY_BROKER_URL = "amqp://phosic:phosic@localhost//"
+CELERY_RESULT_BACKEND = "amqp://phosic:phosic@localhost//"
 CELERY_TASK_SERIALIZER = 'json'
 CELERY_ACCEPT_CONTENT = ['json']
 CELERY_RESULT_SERIALIZER = 'json'
@@ -36,6 +39,6 @@ CELERYBEAT_SCHEDULE = {
     },
     'cleaner': {
         'task': 'phosic.tasks.delete_expired',
-        'schedule': crontab(hour='*/1'),
+        'schedule': crontab(hour='*/%s' % PHOSIC_CLEAN_HOURS),
     },
 }

+ 1 - 1
db_repository/manage.py

@@ -2,4 +2,4 @@
 from migrate.versioning.shell import main
 
 if __name__ == '__main__':
-    main(six='<module 'six' from '/home/kotnik/code/snakepit/phosic/lib/python2.7/site-packages/six.pyc'>')
+    main()

+ 2 - 2
db_repository/migrate.cfg

@@ -1,7 +1,7 @@
 [db_settings]
 # Used to identify which repository this database is versioned under.
 # You can use the name of your project.
-repository_id=database repository
+repository_id=phosic
 
 # The name of the database table used to track the schema version.
 # This name shouldn't already be used by your project.
@@ -17,7 +17,7 @@ version_table=migrate_version
 # entire commit will fail. List the databases your application will actually
 # be using to ensure your updates to that database work properly.
 # This must be a list; example: ['postgres','sqlite']
-required_dbs=[]
+required_dbs=['sqlite']
 
 # When creating new change scripts, Migrate will stamp the new script with
 # a version number. By default this is latest_version + 1. You can set this