-
You need to install Python (preferably 2.6+ but not version 3+ - why you say? Read this.).
-
After you have Python instead, you need to download virtualenv
tar zxvf virtualenv-x-x-x.tar.gz cd virtualenv-x-x-x python setup.py install
-
create a virtualenv instance and activate it
-
run
pip install requirements
-
configure your own
local_settings.py
with your local database information, template path etc. -
you need to install PostgreSQL >= 8.4 on your local machine, create a database and a user role that will be used for this.
-
create a local_settings.py file to hold your local database configuration, project paths etc. an example:
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'freyadb', # Or path to database file if using sqlite3. 'USER': 'xyz', # Not used with sqlite3. 'PASSWORD': '123123', # Not used with sqlite3. 'HOST': 'localhost', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '5432', # Set to empty string for default. Not used with sqlite3. } } FACEBOOK_ID = "1234567890" FACEBOOK_SECRET = "xxx1zCANdsafHAZasfsdfFREYALOVE"
-
run `python manage.py syncdb' # this tells Django to prep and setup the database
-
run
python manage.py migrate --all
# this tells Django to apply all the migrations and bring the database up to sync with the model definitions. -
run
python manage.py runserver
# loads Django's dev server on port 8000, or alternatively you can hook it to your local instance of Gunicorn, Apache etc. -
run
python manage.py loaddata
# loads the dummy data in
The Django app generally relies on facebook-sdk as the only third party library for the API, but there're a bunch of internal dependencies that you can see from requirements.txt
.
- please add *.pyc to your gitignore.
To update any changes to the API, you need to simply restart Apache:
sudo /etc/init.d/httpd restart
To load any fixtures manually,
python manage.py loaddata <fixture name>
sudo /sbin/chkconfig httpd on
sudo /sbin/chkconfig nginx on
sudo /sbin/chkconfig postgresql on
sudo /etc/init.d/postgresql restart
sudo /etc/init.d/httpd restart
sudo /etc/init.d/nginx restart
Set the cron jobs to run as as root
.
sudo crontab -e
Update the client every 10 minutes. Update the API every 30 minutes.
*/10 * * * * cd /var/www/freyalove.com && git reset --hard && git pull origin master && cd www && h5bp && stylus styles/app.styl
*/30 * * * * cd /home/ec2-user/freyalove && git reset --hard && git pull origin master && /home/ec2-user/_env/bin/python manage.py migrate --all && /etc/init.d/httpd restart