Skip to content

Latest commit

 

History

History
126 lines (81 loc) · 2.06 KB

README.md

File metadata and controls

126 lines (81 loc) · 2.06 KB

Embedded Web Server

Team members:

Sepehr Safari 97108263

Sara Khosravi 97101586

Ghazal Shenavar 97101897

Note:

I couldn't fork the main repository of our group project because it's repository (Sharif Embedded Systems) is private. So, in this repository contributions are not defined.

List of contents

Setup project

  1. Go into the project dir:
cd raspberry_webserver
  1. Create a virtual environment:
python -m venv venv
  1. Activate the venv:
source venv/bin/activate
  1. Install requirements:
pip install -r requirements.txt
  1. Build database. You can see the details in Build database section

  2. Make migrations:

python manage.py makemigrations
  1. Migrate:
python manage.py migrate
  1. Create a super user (i.e. an admin):
python manage.py createsuperuser

Build database

  1. install Mysql.

  2. Create the user.

sudo mysql
> CREATE USER 'rasp_user'@'localhost' IDENTIFIED BY 'rasp_user';
> GRANT ALL PRIVILEGES ON * . * TO 'rasp_user'@'localhost';
> FLUSH PRIVILEGES;
> exit
  1. Create the database.
mysql -u rasp_user -p
> CREATE DATABASE `rasp_db` CHARACTER SET utf8;
> exit
  • The specifications of user and database are according to what we've set in settings.py. They are specified in DATABASES variable.

Update database

  1. Make migrations:
python manage.py makemigrations
  1. Migrate:
python manage.py migrate

Run server

Run server:

python manage.py runserver 0.0.0.0:8000
  • Remember to activate and deactivate the server. The commands used are respectively source venv/bin/activate and deactivate.

How to use

The server will be run on 127.0.0.1:8000

Basic routes

/register: Signup.

/login: Login.

/panel: Go to root directory.

/admin: Admin panel. Remember to create an admin with python manage.py createsuperuser command first.