This project is an example of using Django and the django-datatables-view plugin, it can be used as a boiler plate or just to get a better understanding of how to use this great plugin.
In this sample project I will demonstrate how to get up and running django-datatables-view as well as moving past that with some additional technologies which are popular at the moment and how to combine them all to make a working Django site.
In this example I have used two separate databases, the first for the Django admin and authentication and the other is a read only database which could be a real life scenario when you first want to start working with Django.
The sample database used is the the French Towns and Communes from pgfoundry.org.
I have only tested this project with Python 3.x (specifically 3.7.0b3), running on Linux Mint 19 Tara and Postgres SQL 10.5. In theory you should be able to use whatever database you have access to (SQLlite should also work).
- Clone this repository
git clone [email protected]:dre2004/django-datatables-boilerplate.git
- Install Django and other requirements
pip install -r requirements.txt
- Download sample database (French towns) from pgfoundry.org. If you're using Postgres the following instructions should get you up and running.
$ tar zxvf french-towns-communes-francaises-1.0.tar.gz
$ psql -U <INSERT YOUR DB USERNAME> -W postgres
postgres=# create database towns;
CREATE DATABASE
postgres=# create user readonly with password 'securepass123!';
postgres=# \c towns
You are now connected to database "towns" as user "postgres"
towns=# grant select on all tables in schema public to readonly;
GRANT
postgres=#\q
The commands above will need to be run as the postgres root user (typically postgres as seen in the example) or a user with the relevant privileges.
What things you need to install the software and how to install them
- Python 3.x+ - See Python site for platform specific instructions.
- A working database server, my personal preference is Postgresql.
- Time and patients - This is a prerequisite for most things in life :).
This code isn't production ready, so deploy at your own risk. As a guide the minimum you will need to do to get this production ready will be to add authentication / authorization to the admin app and review and harden the settings.py.
- Django 2.2.2 - Python web framework
- django-datatables-view
- bootstrap 4.1.1 - HTML, CSS and Javascript library
- requirejs 2.3.5 - Javascript file and module loader
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Initial work - DRE2004
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details