Books Trading Platform
AntiqueAndRare, a web application to trade the books in different languages, allows users to search books with given filters.
As a new user, you have ability to: Sign up (create account) specifying: languages, location (zip code) and other info. See the books in your area providing your zip code. A user can search for books by title, author, language, ISBN, Genre and Age group.
After registration, you can to log in and: Add books to your bookshelf Edit and delete books from your bookshefl Search for books and sort according to Title, Author or Date(newest first). Send a “Request” for the right book to invite its owner to search your “bookshelf” or send a specific choice what you make. Accept, Decline others' user requests for your book.
We used: Django for full stack development process, HTML for frond-end and Postgres for Database
Steps for run the project on server:
- Check that you have python installed using the following command:
python --version
(use python3 for all following commands if you have python version 3.x)
- Install Django using the following command:
pip install django
- Navigate to the project directory in the terminal using the following command:
cd <name_of_the_directory>
- Create a virtual enviroment using the following command:
python -m venv env
- Activate the virtual enviroment using the following command:
source env/bin/activate
- Install project dependencies by running the following command:
pip install -r requirements.txt
- Set up the database by running the following commands:
python manage.py makemigrations
and
python manage.py migrate
- Create a superuser by running the following command and following the prompts:
python manage.py createsuperuser
- Finally :), to run the server using the following command:
python manage.py runserver
-
Go to 'python manage.py runserver'
-
Create Categories in admin mode. For do it:
- go to "url/admin"
- log in with super user account
- add categories by template: "number_of_category) name_of_category" sorted by age
- log out
#####################################################
Steps to Setup PostgreSQL (from sqlite3):
- move
.envfile tobook_trader/directory (it should be done already after merging pr) - install django-environ
pip install django-environ - install postgres
pip install psycopg2(you probably already have it installed) - dump existing data to a json file
python manage.py dumpdata > whole.json(optional) - change
book_trader/settings.py(already done) - go to psql using
psql -U postgresa) create a new databaseREATE DATABASE your_db_name;b) create a new userCREATE USER your_name WITH ENCRYPTED PASSWORD 'your_password'; c) grant all access to this userGRANT ALL PRIVILEGES ON DATABASE antique_and_rare TO your_name;` d) Save the db name, username, and password for further use. - make migrations
python manage.py makemigrations - migrate
python manage.py migrate, if encounter error sayingpsycopg2.errors.UndefinedTable: relation "some table" does not exist, migrate each app indivisually, then migrate again. - run
python manage.py migrate --run-syncdbto make sure db is connected - open python shell,
python manage.py shella)>>>from django.contrib.contenttypes.models import ContentTypeb)`>>>ContentType.objects.all().delete() - load your saved data into new db
python manage.py loaddata whole.json - run python server
python manage.py runserver