Skip to content

Simple imageboard written in Python/Django

Notifications You must be signed in to change notification settings

akbar22/sunflower

 
 

Repository files navigation

Sunflower

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.

Installation

This assumes you're using virtualenv for deployment

Setting up the project

  • 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).

Running development server

  • Edit settings.py file inside sunflower directory, make sure DEBUG is set to True

  • Then edit run_dev_server.sh file and change DJANGO_DIR to an absolute path to your project (the directory with manage.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.

Running production server

This assumes you're using Nginx as a http server and Gunicorn as WSGI one.

  • Edit settings.py file change DEBUG to True and IMPORTANT SECRET_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 with bind flag when running gunicorn server
    • NUM_WORKERS - number of workers to be used by gunicorn
    • DJANGO_SETTINGS_MODULE - string denoting settings.py module inside the app
    • DJANGO_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

Software used:

About

Simple imageboard written in Python/Django

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published