From 89452b2be0e51567af7419e8ece0c7bdb155d61e Mon Sep 17 00:00:00 2001 From: Nigel Babu Date: Sat, 7 Jul 2012 12:31:30 +0530 Subject: [PATCH] Everything works now, sort of --- .gitignore | 3 ++- hasjob/__init__.py | 8 ++++-- hasjob/search.py | 3 +-- hasjob/uploads.py | 3 ++- instance/settings-sample.py | 48 +++++++++++++++++++++++++++++++++++ instance/settings.py | 50 +++++++++++++++++++++++++++++++++++++ 6 files changed, 109 insertions(+), 6 deletions(-) create mode 100644 instance/settings-sample.py create mode 100644 instance/settings.py diff --git a/.gitignore b/.gitignore index 01e50c2ef..2a46adf8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ .DS_Store *.pyc -settings.py test.db *.wpr .project @@ -9,3 +8,5 @@ test.db .sass-cache error.log .coverage +instance/production.py +instance/development.py diff --git a/hasjob/__init__.py b/hasjob/__init__.py index 7aa9f610b..905181d31 100644 --- a/hasjob/__init__.py +++ b/hasjob/__init__.py @@ -6,7 +6,6 @@ from flask.ext.mail import Mail from flask.ext.assets import Environment, Bundle from coaster import configureapp -import uploads, search # First, make an app and config it @@ -15,9 +14,10 @@ mail = Mail() mail.init_app(app) assets = Environment(app) +from uploads import configure +from search import configure uploads.configure() search.configure() - # Second, setup assets assets = Environment(app) @@ -35,5 +35,9 @@ import hasjob.models import hasjob.views +from uploads import configure +from search import configure +uploads.configure() +search.configure() if environ.get('HASJOB_ENV') == 'prod': import hasjob.loghandler diff --git a/hasjob/search.py b/hasjob/search.py index 314680639..c47c672ef 100644 --- a/hasjob/search.py +++ b/hasjob/search.py @@ -4,8 +4,7 @@ from whoosh.qparser import QueryParser from whoosh.analysis import StemmingAnalyzer -import models -from app import app +from hasjob import models, app search_schema = fields.Schema(title=fields.TEXT(stored=True), content=fields.TEXT(analyzer=StemmingAnalyzer()), diff --git a/hasjob/uploads.py b/hasjob/uploads.py index fd4e257fd..e014ca22b 100644 --- a/hasjob/uploads.py +++ b/hasjob/uploads.py @@ -4,7 +4,8 @@ from werkzeug import FileStorage from flask.ext.uploads import UploadSet, configure_uploads, IMAGES, UploadNotAllowed -from app import app + +from hasjob import app uploaded_logos = UploadSet('logos', IMAGES) diff --git a/instance/settings-sample.py b/instance/settings-sample.py new file mode 100644 index 000000000..c882c7e85 --- /dev/null +++ b/instance/settings-sample.py @@ -0,0 +1,48 @@ +#: The title of this site +SITE_TITLE='Job Board' +#: TypeKit code for fonts +TYPEKIT_CODE='' +#: Google Analytics code UA-XXXXXX-X +GA_CODE='' +#: Database backend +SQLALCHEMY_DATABASE_URI = 'sqlite:///test.db' +#: Secret key +SECRET_KEY = 'make this something random' +#: Timezone +TIMEZONE = 'Asia/Calcutta' +#: Upload path +UPLOADED_LOGOS_DEST='/tmp/uploads' +#: Search index path +SEARCH_INDEX_PATH='/tmp/search' +#: Mail settings +#: MAIL_FAIL_SILENTLY : default True +#: MAIL_SERVER : default 'localhost' +#: MAIL_PORT : default 25 +#: MAIL_USE_TLS : default False +#: MAIL_USE_SSL : default False +#: MAIL_USERNAME : default None +#: MAIL_PASSWORD : default None +#: DEFAULT_MAIL_SENDER : default None +MAIL_FAIL_SILENTLY = False +MAIL_SERVER = 'localhost' +DEFAULT_MAIL_SENDER = ('Job Board', 'test@example.com') +#: Logging: recipients of error emails +ADMINS=[] +#: Log file +LOGFILE='error.log' +#: Use SSL for some URLs +USE_SSL=False +#: Twitter integration (register as a "client" app) +TWITTER_ENABLED=False +TWITTER_CONSUMER_KEY = '' +TWITTER_CONSUMER_SECRET = '' +TWITTER_ACCESS_KEY = '' +TWITTER_ACCESS_SECRET = '' +#: Bit.ly integration for short URLs +BITLY_USER = '' +BITLY_KEY = '' +#: Access key for periodic server-only tasks +PERIODIC_KEY = '' +#: Throttle limit for email domain +THROTTLE_LIMIT = 5 +SUPPORT_EMAIL = 'person@example.com' diff --git a/instance/settings.py b/instance/settings.py new file mode 100644 index 000000000..8a6ec0fec --- /dev/null +++ b/instance/settings.py @@ -0,0 +1,50 @@ +#: The title of this site +SITE_TITLE='Job Board' +#: TypeKit code for fonts +TYPEKIT_CODE='' +#: Google Analytics code UA-XXXXXX-X +GA_CODE='' +#: Database backend +SQLALCHEMY_DATABASE_URI = 'mysql://root:@localhost/hasjob' +#: Secret key +SECRET_KEY = 'make this something random' +#: Timezone +TIMEZONE = 'Asia/Calcutta' +#: Upload path +UPLOADED_LOGOS_DEST='/tmp/uploads' +#: Search index path +SEARCH_INDEX_PATH='/tmp/search' +#: Mail settings +#: MAIL_FAIL_SILENTLY : default True +#: MAIL_SERVER : default 'localhost' +#: MAIL_PORT : default 25 +#: MAIL_USE_TLS : default False +#: MAIL_USE_SSL : default False +#: MAIL_USERNAME : default None +#: MAIL_PASSWORD : default None +#: DEFAULT_MAIL_SENDER : default None +MAIL_FAIL_SILENTLY = False +MAIL_SERVER = 'localhost' +DEFAULT_MAIL_SENDER = ('Job Board', 'test@example.com') +MAIL_USERNAME = None +MAIL_PASSWORD = None +#: Logging: recipients of error emails +ADMINS=['nigel@hasgeek.com'] +#: Log file +LOGFILE='error.log' +#: Use SSL for some URLs +USE_SSL=False +#: Twitter integration (register as a "client" app) +TWITTER_ENABLED=False +TWITTER_CONSUMER_KEY = '' +TWITTER_CONSUMER_SECRET = '' +TWITTER_ACCESS_KEY = '' +TWITTER_ACCESS_SECRET = '' +#: Bit.ly integration for short URLs +BITLY_USER = '' +BITLY_KEY = '' +#: Access key for periodic server-only tasks +PERIODIC_KEY = '' +#: Throttle limit for email domain +THROTTLE_LIMIT = 5 +SUPPORT_EMAIL = 'info@hasgeek.com'