Django application that shows how to serve files with Apache and X-SENDFILE by using django-sendfile.
This project also serves as a playground for other technologies.
This is a pretty normal Django application, nothing too fancy. So you could just
grab the xsendfile_example
folder and run with it. But to make it a bit easier
I provide 3 options to run this application.
Install Docker.
Docker lets you provision container images including your application which you can then deploy and run.
Build the image:
docker build --tag xsendfile-example .
Run the container:
docker run --rm -p 8082:80 -v /path/to/your/data:/data xsendfile-example
Browse to http://localhost:8082/
Install Vagrant, VirtualBox and Fabric+fabtools.
Vagrant helps with provisioning VMs especially for development, in this case VirtualBox VMs. Fabric is a command-line tool for application deployment via SSH.
Boot and provision the VM:
vagrant up default
Deploy the application
fab vagrant:default deploy
Browse to http://localhost:8080/
This option works pretty much the same as the one before except that it uses Ansible, so you have to install that too.
Ansible is a configuration management tool that lets you automate server installations not only for development but also for production.
Boot and provision the VM:
vagrant up ansible
Deploy the application
fab vagrant:ansible deploy
Browse to http://localhost:8081/
If you want to run the project using Django's development server you have to set
another backend in xsendfile_example/settings.py
:
SENDFILE_BACKEND = 'sendfile.backends.development'