diff --git a/README.md b/README.md index 18a6bd2f3..cf0eaf597 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,29 @@ Don't copy ours. We will like you better if you contribute a patch. This code runs on [Python][] with the [Flask][] microframework. You will need to install all the requirements listed in `requirements.txt` using `easy_install` or `pip`. Copy `settings-sample.py` to `settings.py`, edit as -necessary, and start the server with: +necessary, and finish configuration with: + + $ python manage.py db create + $ python manage.py configure + +To run the server in development mode: $ python runserver.py -WSGI is recommended for production. Enable `mod_wsgi` in Apache and make a +WSGI is recommended for production. For Apache: enable `mod_wsgi` and make a `VirtualHost` with: WSGIScriptAlias / /path/to/website.wsgi +For Nginx, run website.py under uWSGI and proxy to it: + + location / { + include uwsgi_params; # Include common uWSGI settings here + uwsgi_pass 127.0.0.1:8093; + uwsgi_param UWSGI_CHDIR /path/to/hasjob/git/repo/folder; + uwsgi_param UWSGI_MODULE website; + } + + [Python]: http://python.org/ [Flask]: http://flask.pocoo.org/ diff --git a/hasjob/__init__.py b/hasjob/__init__.py index a96d42f08..263a734b6 100644 --- a/hasjob/__init__.py +++ b/hasjob/__init__.py @@ -41,9 +41,7 @@ def init_for(env): 'jquery.tinymce', 'jquery.form', 'jquery.cookie', 'select2', 'jquery.sparkline', 'baseframe-networkbar', 'hasjob' ]) app.assets.register('js_tinymce', assets.require('tiny_mce.js>=3.5.0,<4.0.0')) - from hasjob.search import configure as search_configure from hasjob.uploads import configure as uploads_configure - search_configure() uploads_configure() mail.init_app(app) lastuser.init_app(app) diff --git a/hasjob/models/__init__.py b/hasjob/models/__init__.py index b025c2cb1..7d3721001 100644 --- a/hasjob/models/__init__.py +++ b/hasjob/models/__init__.py @@ -33,9 +33,9 @@ class EMPLOYER_RESPONSE(LabeledEnum): REJECTED = (6, u"Rejected") # Employer rejected candidate with a message +from hasjob.models.user import * from hasjob.models.jobcategory import * from hasjob.models.jobpostreport import * from hasjob.models.jobtype import * from hasjob.models.reportcode import * from hasjob.models.jobpost import * -from hasjob.models.user import * diff --git a/manage.py b/manage.py index c7d560fa6..2605ededf 100644 --- a/manage.py +++ b/manage.py @@ -4,9 +4,18 @@ from hasjob.models import db from hasjob import app, init_for +from hasjob.search import configure as search_configure + + +def configure(env='dev'): + """Configure Hasjob's search indexing""" + init_for(env) + search_configure() if __name__ == '__main__': db.init_app(app) manager = init_manager(app, db, init_for) + manager.command(configure) + manager.run()