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
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
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 flask import Flask
|
||||
from flask_restful import Api, Resource, reqparse
|
||||
from flask_cors import CORS
|
||||
import random
|
||||
import os
|
||||
|
||||
@ -95,6 +96,7 @@ def _add_a_attrs(soup):
|
||||
|
||||
|
||||
api = Flask(__name__)
|
||||
CORS(api)
|
||||
_api = Api(api)
|
||||
|
||||
_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
|
||||
flask==1.1.2
|
||||
gunicorn==20.0.4
|
||||
aniso8601==9.0.1
|
||||
beautifulsoup4==4.9.3
|
||||
click==8.0.1
|
||||
Flask-RESTful==0.3.9
|
||||
itsdangerous==2.0.1
|
||||
Jinja2==3.0.1
|
||||
Markdown==3.3.4
|
||||
MarkupSafe==2.0.1
|
||||
pytz==2021.1
|
||||
six==1.16.0
|
||||
soupsieve==2.2.1
|
||||
aniso8601==9.0.1
|
||||
appdirs==1.4.4
|
||||
beautifulsoup4==4.9.3
|
||||
certifi==2021.5.30
|
||||
click==8.0.1
|
||||
distlib==0.3.2
|
||||
filelock==3.0.12
|
||||
Flask==1.1.2
|
||||
Flask-Cors==3.0.10
|
||||
Flask-RESTful==0.3.9
|
||||
gunicorn==20.0.4
|
||||
itsdangerous==2.0.1
|
||||
Jinja2==3.0.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