Server : 1 Class Diagram, Installation, and Run A Django Server - 17chuchu/AutomaticBicycleInterface GitHub Wiki
These Server instructions will explain basic Django features and how to install libraries required by this server-side application.
The Server part of the project is located in a folder called 'server'.
Table of Contents
Class Diagram
Installing
I advise you to use PyCharm Professional edition because it can easily install most of the dependencies for this application. Alternatively, you can also use pip to install all the dependency. I will explain all the method that is used to install dependencies.
Install pip
pip is an easy way to install python's dependencies on your machine. The following command will install pip on Ubuntu.
sudo easy_install pip
Then you can this command to install any python dependencies.
sudo pip install
Or use this other command if errors happen or you have python3 and python2 installed in the same machine.
sudo pip3 install
Install all necessary dependencies.
There is a text file called requirement.txt in the server folder. Move to the location using Terminator then execute this command.
sudo pip install -r requirements.txt
Then you need to install a dependency called simple-websocket-server by executing this command.
sudo pip install git+https://github.com/dpallot/simple-websocket-server.git
Visit this link for more detail on simple-websocket-server.
Check and run Django
Check Django
In order to check if Django is installed in your machine, run the following command.
django-admin --version
If you haven't instal Django yet, run this command to install Django on your Ubuntu machine.
sudo pip install django
Run Django
To run this Django server on port 8000, locate a file called manage.py in the server folder using Terminal. Then run this command.
python manage.py runserver 0.0.0.0:8000
Or run this command if you have python3 and python2 installed in the same machine. This application was developed using python3.
python3 manage.py runserver 0.0.0.0:8000
Others
This is an additional documentation about Django in case you want to develop this application further.
Migrate Django database
There is a python file in this project that is dedicated for managing all models (database scheme) for this Django project. I also provide a model in the file as an example.
To update (migrate) Django's database, follow these instructions. Locate this file called manage.py, then execute this command. It will create all the commands necessary for updating or creating tables.
python manage.py makemigrations
If no error occurs, execute this command to execute commands that are created from makemigrations.
python manage.py migrate
See this document for additional information about Django migrations.