Commit 92cfb810 authored by D.H.D. Nguyen's avatar D.H.D. Nguyen
Browse files

add docstrings args for config.py

parent 234b4100
Loading
Loading
Loading
Loading
+34 −2
Original line number Diff line number Diff line
@@ -14,6 +14,17 @@ basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
	"""
	Base Configurations used for all servers.

	Args:
		SECRET_KEY (str): secret key of the web application
		BASE_DIR (str): base directory of the application
		SQLALCHEMY_TRACK_MODIFICATIONS (bool): whether to track modification when using SQLAlchemy, *default:* ``False``
		SQLALCHEMY_DATABASE_URI (str): directory of the local SQL database, *default:* ``SQLite database``
		MTURK_URL (str): endpoint of Amazon Crowdsourcing Platform, *default:* ``None``
		MTURK_SHOW_UP_URL (str): link to where the project is uploaded (mainly in production environment), *default:* `real page <https://requester.mturk.com/>`__
		
	Methods:
		init_app(app) : Application initialization	
	"""
	SECRET_KEY = os.environ.get('SECRET_KEY') or 'Thisissupposedtobesecret!'
	SQLALCHEMY_TRACK_MODIFICATIONS = False
@@ -28,13 +39,22 @@ class Config:

class DevelopmentConfig(Config):
	"""
	Configurations used during development.
	Extends :class:`Config`. Configurations used during development.

	Args:
		FLASK_ENV (str): environment of the application, *default:* ``development``
		DEBUG (bool): whether to debug during running the application, *default:* ``True``
		SQLALCHEMY_DATABASE_URI (str): SQL database used for development
		MTURK_URL (str): endpoint of Amazon Crowdsourcing Platform, used in Development environment, *default:* `sandbox in us-east-1 region <https://mturk-requester-sandbox.us-east-1.amazonaws.com>`__
		AWS_ACCESS_KEY_ID (str): IAM AWS credentials - key id, *default:* ``None``
		AWS_SECRET_ACCESS_KEY (str): IAM AWS credentials - secret access key, *default:* ``None``
		MTURK_SHOW_UP_URL: link to where the project is uploaded, in development environment, *default:* `Sandbox <https://workersandbox.mturk.com/>`__
	"""
	FLASK_ENV = 'development'
	DEBUG = True
	SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URL') or \
								 'sqlite:///%s'%(os.path.join(basedir, 'database-dev.db'))
	MTURK_URL = 'https://mturk-requester-sandbox.us-east-1.amazonaws.com' # in production mode this will be NONE!!
	MTURK_URL = 'https://mturk-requester-sandbox.us-east-1.amazonaws.com'
	AWS_ACCESS_KEY_ID = None#"AKIAI57NPWPWYHGOWIPQ"
	AWS_SECRET_ACCESS_KEY = None#"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"
	MTURK_SHOW_UP_URL = "https://workersandbox.mturk.com/"
@@ -42,6 +62,12 @@ class DevelopmentConfig(Config):
class TestingConfig(Config):
	"""
	Configurations used during testing.

	Args:
		DEBUG (bool): whether to debug during running the application, *default:* ``False``
		TESTING (bool): whether to set this application in testing environment, *default:* ``True``
		SQLALCHEMY_DATABASE_URI (str): SQL database used for testing
		WTF_CSRF_ENABLED (bool): whether to enable CSRF Token for different input forms in HTML, *default:* ``False``
	"""
	DEBUG = False
	TESTING = True
@@ -57,5 +83,11 @@ config = {
}
""" 
Global variable for environment configurations.
Can import this instead of configuration objects.

2 environments are available:
	* For development
	* For testing

Default is development environment.
"""
 No newline at end of file