updated code to include cors
This commit is contained in:
parent
6664f307be
commit
fa0d8a2ed7
@ -22,12 +22,6 @@ To run the development server run, you MUST have run `pip install` first:
|
|||||||
gunicorn -c gunicorn.config.py dev:api
|
gunicorn -c gunicorn.config.py dev:api
|
||||||
```
|
```
|
||||||
|
|
||||||
Due to production container using .pipfiles and pipenv make sure to run the following to regenerate the pip files before a release commit:
|
|
||||||
```shell
|
|
||||||
# Run this in dev container
|
|
||||||
pipenv install -r requirements.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
## Caveats
|
## Caveats
|
||||||
|
|
||||||
Currently there is no git in the container so you can't see what's been edited or not, git will have to be managed from the host.
|
Currently there is no git in the container so you can't see what's been edited or not, git will have to be managed from the host.
|
||||||
|
|||||||
2
app.py
2
app.py
@ -2,6 +2,7 @@ from bs4 import BeautifulSoup
|
|||||||
from markdown import markdown
|
from markdown import markdown
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
from flask_restful import Api, Resource, reqparse
|
from flask_restful import Api, Resource, reqparse
|
||||||
|
from flask_cors import CORS
|
||||||
import random
|
import random
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -95,6 +96,7 @@ def _add_a_attrs(soup):
|
|||||||
|
|
||||||
|
|
||||||
api = Flask(__name__)
|
api = Flask(__name__)
|
||||||
|
CORS(api)
|
||||||
_api = Api(api)
|
_api = Api(api)
|
||||||
|
|
||||||
_api.add_resource(Post, "/post/<string:slug>")
|
_api.add_resource(Post, "/post/<string:slug>")
|
||||||
|
|||||||
@ -1,14 +1,22 @@
|
|||||||
# To ensure app dependencies are ported from your virtual environment/host machine into your container, run 'pip freeze > requirements.txt' in the terminal to overwrite this file
|
aniso8601==9.0.1
|
||||||
flask==1.1.2
|
appdirs==1.4.4
|
||||||
gunicorn==20.0.4
|
beautifulsoup4==4.9.3
|
||||||
aniso8601==9.0.1
|
certifi==2021.5.30
|
||||||
beautifulsoup4==4.9.3
|
click==8.0.1
|
||||||
click==8.0.1
|
distlib==0.3.2
|
||||||
Flask-RESTful==0.3.9
|
filelock==3.0.12
|
||||||
itsdangerous==2.0.1
|
Flask==1.1.2
|
||||||
Jinja2==3.0.1
|
Flask-Cors==3.0.10
|
||||||
Markdown==3.3.4
|
Flask-RESTful==0.3.9
|
||||||
MarkupSafe==2.0.1
|
gunicorn==20.0.4
|
||||||
pytz==2021.1
|
itsdangerous==2.0.1
|
||||||
six==1.16.0
|
Jinja2==3.0.1
|
||||||
soupsieve==2.2.1
|
Markdown==3.3.4
|
||||||
|
MarkupSafe==2.0.1
|
||||||
|
pipenv==2021.5.29
|
||||||
|
pytz==2021.1
|
||||||
|
six==1.16.0
|
||||||
|
soupsieve==2.2.1
|
||||||
|
virtualenv==20.4.7
|
||||||
|
virtualenv-clone==0.5.4
|
||||||
|
Werkzeug==2.0.1
|
||||||
|
|||||||
Reference in New Issue
Block a user