To set up this project on your own machine, perform these steps.
- Fork this repository, then clone it. Fork it via the Github website, then clone it with either Github desktop or the command line (if you've got the ssh keys set up)
$ git clone git@github.com:GirlsCodeMK/libraryapp-hackathon-python-starthere.git
- Once you have a copy of the repository, open a terminal in that directory
$ cd /path/to/libraryapp-hackathon-python-starthere/
- Once there, create and activate a virtual environment for the project
$ python3 -m venv gcmk
$ source gcmk/bin/activate
- Install the required libraries, such as Django
(gcmk) $ pip install -r requirements.txt
- Check you have the correct version
(gcmk) $ python -m django --version
2.1.4
- Run a migration to create the database
(gcmk) $ python manage.py migrate
This migration creates the Librarian and Library user groups and assigns the correct permissions to them.
There are two options here: either use the pre-populated sample data, or create users and data yourseelf.
After running migrate, pick one of the datasets to include in the database.
- Sample users
(gcmk) $ python manage.py loaddata library-user.json
- Sample users, and sample books & loans
(gcmk) $ python manage.py loaddata library-user-library.json
Then run the server:
(gcmk) $ python manage.py runserver
and visit the library site (127.0.0.1:8000/library) in a web browser. The admin site is at 127.0.0.1:8000/admin should you need it.
- Create a superuser
(gcmk) $ python manage.py createsuperuser
- Run the server, and open the admin site (
127.0.0.1:8000/admin) in a web browser
(gcmk) $ python manage.py runserver
- In the admin site, create some users, books, copies, and loans. Create at least one librarian and one library-user.
The Django documentation is essential reading, including the Django "getting started" tutorial.
This application is based on the DjangoGirls tutorial systemm and the Mozilla Development tutorial.