Installation guide
Welcome to the Sign app developers team! This guide will assist you in setting up your development environment.
Requirements Flutter and Python
Here are all the items that must be present on your local machine to get started. Of course, if you only want to work on one part, not all items are necessary. For example, if you only want to work on the app, you only need to have Flutter installed.
We're assuming that you've got Git and an IDE all set up. If you're not sure which IDE to use, no worries! We recommend PyCharm for Python and Android Studio for Flutter.
-
Install the Flutter SDK from the official Flutter website. Choose the link for your operating system and follow the instructions. Or use Android studio to install Flutter.
-
Make sure you have Python installed. Check your Python version with the following command
Version 3.8, 3.9, 3.10 and 3.11 are acceptable as these versions are compatible with Django 4.1python --version
-
Check if pip is installed with the following command:
If pip is not installed look at the official pip website for an installation guide for you operating system.pip --version
-
Optional but recommended is installing a virtual environment for python like virtualenv.
Setting up the Project
- Clone or download the project source code from the project's GitHub repository.
For example:
git clone git@github.com:Signbank/sign-app.git
Flutter
-
Set up the Flutter app by opening the project folder in a code editor and running flutter pub get in the terminal to install any required packages.
-
In the Flutter app code, update the url_config file to switch between localhost and the server. For example:
This will make sure the app uses the local Django server.bool _signAppLocalhost = true
-
Run the Flutter app on an emulator or physical device by running flutter run in the terminal or through Android studio. The app should be able to communicate with the local Django server and fetch data from the API endpoints.
Django
-
Create a virtual environment
virtualenv env
-
Activate the virtual environment
source env/bin/activate
-
Set up the Django backend by navigating to the backend folder (called django) in the terminal and running python manage.py migrate to create the database tables. Optionally, you can create a superuser account by running python manage.py createsuperuser.
-
Install the required packages by running the following command:
pip -r install requirements.txt
-
Set up Django secrete key by creating a .env file in the signapp directory. You can create this file with the following command on unix systems:
NOTE: It is a hidden file so enable hidden files in your file explorer or use ls -a command to see it.touch signapp/.env
-
Add the following line to the .env file:
For local development the key can be any string.SECRET_KEY = 'django-insecure-super-ultra-secret-key'
-
Run the Django server by running python manage.py runserver in the terminal. The server will start at http://localhost:8000/.
Documentation
-
Install MkDocs Material with the following command:
pip install mkdocs-material
-
Run the server:
mkdocs serve
-
Edit and save the documentation markdown files and see you changes at http://localhost:8000/.
Server
- Follow these steps to setup apache on the LXD container. On step 7 add the folliwing line instead of the one in the guide:
ProxyPass /api http:localhost:8000/
This redirects all api traffic to Django localhost.
-
Build a Flutter web app with the following command:
flutter build web
-
Place the contents of the flutter web build on the server in the /var/www/html directory and remove the default index.html.