Skip to content
Snippets Groups Projects
README.md 1.8 KiB
Newer Older
root's avatar
root committed
REST API prototype created using Django, Neo4j, Neomodel and Django REST Framework (DRF).
Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
## Clone the repository
~~~
git clone https://git.embl.de/yelmoubayed/new-dp-service.git    
cd <repository>
~~~

Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
## Create a virtual environment to isolate the package dependencies locally
~~~
python3 -m venv env 
~~~
~~~
Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
source env/bin/activate #On Linux and MacOS  
Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
env\Scripts\activate #On Windows    
Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
## Install requirements
Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
pip install -r requirements.txt
Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
## Add new requirements if needed 
Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
pip freeze > requirements.txt
Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
## Django's most important command lines
Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
This command is used to create a project
Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
~~~
Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
django-admin startproject <project name>
django-admin.py startproject <project name>
Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
This command is used to create an application inside a project
Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
python manage.py <app name>
~~~

This command applies migrations
~~~
python manage.py migrate
Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
This command creates new migrations based on the changes you have made to your models
Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
python manage.py makemigrations
Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
This command opens a python shell to test query sets
Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
~~~
python manage.py shell
~~~
Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed

Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
This command runs an emulated server on your local machine
~~~
python manage.py runserver <optional port number>
~~~

This command creates a super user to access the admin panel
~~~
python manage.py createsuperuser
~~~

This command creates a cache table 
~~~
python manage.py createcachetable
~~~

This command applies neomodel constraints
~~~
python manage.py install_labels 
~~~

Yorgo EL MOUBAYED's avatar
Yorgo EL MOUBAYED committed
## Links to official documentations

root's avatar
root committed
* **Django:** <https://docs.djangoproject.com/en/3.1/>
* **Neomodel:** <https://neomodel.readthedocs.io/en/latest/>
* **Neo4j:** <https://neo4j.com/docs/>
root's avatar
root committed
* **DRF:** <https://www.django-rest-framework.org/>
root's avatar
root committed
* **Serializing neomodel data:** <https://neo4j-examples.github.io/paradise-papers-django/tutorial/part01.html>