Sunflower is a simple image gallery written in Django framework. It strives to be easy to use and focus on presenting content in a clear and distraction free fashion.
This assumes you're using virtualenv
for deployment
- Create new virtualenv folder
virtualenv <project_name>
- Activate it:
# from withing <project_name> folder
source bin/activate
- Clone sunflower repository:
git clone https://github.com/exaroth/sunflower.git
- Lastly install all the requirements:
# from within sunflower folder
pip install -r requirements.txt
- (Optional) Install memcached and run it on port 11211:
# for mac users
brew install memcached
# for linux users
sudo apt-get install memcached
Then run it:
memcached -d -p 11211
Note: Sunflower will still run even without memcached but the content won't be cached (d'oh).
-
Edit
settings.py
file insidesunflower
directory, make sureDEBUG
is set toTrue
-
Then edit
run_dev_server.sh
file and changeDJANGO_DIR
to an absolute path to your project (the directory withmanage.py
file) -
Execute
run_dev_server.sh
:
sh run_dev_server.sh
This will start django dev server along with grunt and will compile less and refresh browser each time you make any changes to html, js or less files.
This assumes you're using Nginx as a http server and Gunicorn as WSGI one.
-
Edit
settings.py
file changeDEBUG
toTrue
and IMPORTANTSECRET_KEY
value to anything you like. -
Define database backend inside
settings.py
- see relevant entry in Django documentation for details -
Edit
run_sunflower.sh
script, inside you will find following variables (starred entries should be changed):APP_NAME
- name of the application- *
DJANGO_DIR
- absolute path to the project - *
SOCKET_FILE
- absolute path to unix socket file to be used withbind
flag when running gunicorn server NUM_WORKERS
- number of workers to be used by gunicornDJANGO_SETTINGS_MODULE
- string denoting settings.py module inside the appDJANGO_WSGI_MODULE
- same as above but for wsgi module
-
Then configure Nginx server to use gunicorn as reverse proxy. You can find example configuration that works fairly well in Gunicorn documentation
-
Finally run memcached, execute
run_sunflower.sh
and restart Nginx with new configuration and you're set to go