Skip to content

Commit d90fac8

Browse files
committed
Initial setup of the curriculumAPI package.
- Used Blueprints to create two different modules - API module will be a RESTful service for curriculum data - Explorer module will serve the explore website
0 parents commit d90fac8

File tree

6 files changed

+61
-0
lines changed

6 files changed

+61
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
venv
2+
*.egg-info

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# curriculumAPI
2+
This is the backend that will support both the curriculum website and the plugin.
3+
It will interface these frontends with the database and curriculum repository.
4+
5+
## Setup
6+
Setup the virtual environment.
7+
```
8+
python3 -m venv venv
9+
```
10+
Every time you work on the project, start up venv:
11+
```
12+
. venv/bin/activate
13+
```
14+
Install Flask:
15+
```
16+
pip install Flask
17+
```
18+
Windows instructions at http://flask.pocoo.org/docs/1.0/installation/#installation
19+
20+
## Running for the first time
21+
```
22+
export FLASK_APP=curriculumAPI
23+
pip install -e .
24+
flask run
25+
```
26+
Instructions may be different on Windows.
27+
28+

curriculumAPI/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from flask import Flask
2+
from curriculumAPI.api import curriculum_api
3+
from curriculumAPI.explorer import explorer
4+
5+
app = Flask(__name__)
6+
app.register_blueprint(curriculum_api, url_prefix='/api')
7+
app.register_blueprint(explorer)

curriculumAPI/api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from flask import Blueprint
2+
3+
curriculum_api = Blueprint('curriculum_api', __name__, template_folder='templates')
4+
5+
@curriculum_api.route('/test')
6+
def test():
7+
return 'API test'

curriculumAPI/explorer.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from flask import Blueprint
2+
3+
explorer = Blueprint('explorer', __name__, template_folder='templates')
4+
5+
@explorer.route('/test')
6+
def test():
7+
return 'Explorer test'

setup.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from setuptools import setup
2+
3+
setup(
4+
name='curriculumAPI',
5+
packages=['curriculumAPI'],
6+
include_package_data=True,
7+
install_requires=[
8+
'flask',
9+
],
10+
)

0 commit comments

Comments
 (0)