Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

Commit 36dfac4

Browse files
author
Nir Galon
authored
Change backend to Sanic project(#85)
1 parent 6f6e1d9 commit 36dfac4

24 files changed

+308
-394
lines changed

β€Žserver/Dockerfileβ€Ž

Lines changed: 0 additions & 21 deletions
This file was deleted.

β€Žserver/Pipfileβ€Ž

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[[source]]
2+
3+
url = "https://pypi.python.org/simple"
4+
verify_ssl = true
5+
name = "pypi"
6+
7+
8+
[packages]
9+
10+
sanic = "*"
11+
aiopg = "*"
12+
peewee-async = "*"
13+
peewee = "*"
14+
15+
16+
[dev-packages]
17+
18+
19+
20+
[requires]
21+
22+
python_version = "3.6"

β€Žserver/Pipfile.lockβ€Ž

Lines changed: 154 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žserver/README.mdβ€Ž

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
## Server
22

3-
The server (backend) side of the project written [Python](https://www.python.org/) using [Django 1.11](https://www.djangoproject.com/), [Django REST framework](http://www.django-rest-framework.org/).
3+
The server (backend) side of the project written [Python](https://www.python.org/) using [Sanic](https://github.com/channelcat/sanic).
44

55
## Prerequisites
66

77
* Install [Python 3.x](https://www.python.org/)
8+
* Install [Pipenv](https://github.com/pypa/pipenv)
89
* Install [Pip](https://pypi.python.org/pypi/pip)
910

1011
## Manual Installation
1112

12-
1. `cd server/config` then `cp local_settings.template local_settings.py` and modify it by your local settings
13-
2. Install requirements with `pip install -r requirements.txt`
14-
3. Migrate the data with `python manage.py migrate`
15-
4. Run the server with `python manage.py runserver`
16-
5. Open the browser at [http://localhost:8000](http://localhost:8000)
13+
1. Create a file called `.env` at the root of the project and write the configurations of the server there. Here is an example of the `.env` file:
14+
```
15+
DB_URI = 'mongodb://localhost:27017/assp'
16+
JWT = 'ASSP'
17+
PORT = '8000'
18+
LOG_LEVEL = 'info'
19+
ENV = 'development'
20+
```
21+
2. Create a virtual environment with `pipenv install` at the root of the project.
22+
3. Get in to the virtual environment with `pipenv shell`.
23+
4. Run the server with the `.env` file `ENV_VARS=.env python main.py`
24+
5. Hit [http://localhost:8000](http://localhost:8000) with Postman.
1725

1826
## Tests
1927

20-
* Run `pycodestyle --show-source --max-line-length=120 --show-pep8 server;` to check for lint mistakes (by PEP8)
21-
* Run `python manage.py test` to execute the unit tests
28+
Not Yet..

β€Žserver/api/apps.pyβ€Ž

Lines changed: 0 additions & 5 deletions
This file was deleted.

β€Žserver/api/serializers.pyβ€Ž

Lines changed: 0 additions & 8 deletions
This file was deleted.

β€Žserver/api/tests.pyβ€Ž

Lines changed: 0 additions & 22 deletions
This file was deleted.

β€Žserver/api/urls.pyβ€Ž

Lines changed: 0 additions & 10 deletions
This file was deleted.
File renamed without changes.

β€Žserver/api/users/model.pyβ€Ž

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from datetime import date
2+
from peewee import Model, CharField, TextField, DateField
3+
4+
5+
class User(Model):
6+
name = CharField(max_length=40)
7+
age = TextField(default=0)
8+
email = CharField(unique=True, null=False)
9+
date_joined = DateField(default=date.today())

0 commit comments

Comments
Β (0)