├── .babelrc
├── .dockerignore
├── .gitignore
├── .requirements
├── Dockerfile
├── LICENSE
├── README.md
├── __init__.py
├── api
├── __init__.py
└── v1
│ ├── __init__.py
│ └── basic.py
├── app.py
├── assets
├── fonts
│ ├── Butler_Black.otf
│ ├── Butler_Bold.otf
│ ├── Butler_ExtraBold.otf
│ ├── Butler_Light.otf
│ ├── Butler_Medium.otf
│ ├── Butler_Regular.otf
│ └── Butler_Ultra_Light.otf
├── images
│ ├── lines-of-code.gif
│ ├── loading.gif
│ └── write.gif
└── scss
│ ├── _fonts.scss
│ ├── _functions.scss
│ ├── _layout.scss
│ └── app.scss
├── database.db
├── database.py
├── docker-compose.yml
├── js
├── app.js
└── components
│ ├── app.jsx
│ ├── intro.jsx
│ └── quill.jsx
├── models
├── Component.py
└── __init__.py
├── package-lock.json
├── package.json
├── readme-files
└── flask-react.gif
├── run.sh
├── static
└── .gitkeep
├── templates
└── app.html
└── webpack.config.js
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets":[
3 | "@babel/preset-env", "@babel/preset-react"
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | webkit-build
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.py[co]
2 |
3 | # Packages
4 | *.egg
5 | *.egg-info
6 | dist
7 | build
8 | eggs
9 | parts
10 | bin
11 | var
12 | sdist
13 | develop-eggs
14 | .installed.cfg
15 |
16 | # exclude everything
17 | static/*
18 |
19 | # exception to the rule
20 | !static/.gitkeep
21 |
22 | # Installer logs
23 | pip-log.txt
24 |
25 | # virtualenv
26 | venv
27 |
28 | # tox
29 | .eggs
30 | .tox
31 |
32 | # Logs
33 | logs
34 | *.log
35 | npm-debug.log*
36 |
37 | # Runtime data
38 | pids
39 | *.pid
40 | *.seed
41 | *.pid.lock
42 |
43 | # Directory for instrumented libs generated by jscoverage/JSCover
44 | lib-cov
45 |
46 | # node-waf configuration
47 | .lock-wscript
48 |
49 | # Compiled binary addons (https://nodejs.org/api/addons.html)
50 | build/Release
51 |
52 | # Dependency directories
53 | node_modules/
54 | jspm_packages/
55 |
56 | # Typescript v1 declaration files
57 | typings/
58 |
59 | # Optional npm cache directory
60 | .npm
61 |
62 | # Optional eslint cache
63 | .eslintcache
64 |
65 | # Optional REPL history
66 | .node_repl_history
67 |
68 | # Output of 'npm pack'
69 | *.tgz
70 |
71 | # dotenv environment variables file
72 | .env
73 |
74 | # assets manifest
75 | manifest.json
76 | *.json~
77 |
--------------------------------------------------------------------------------
/.requirements:
--------------------------------------------------------------------------------
1 | Flask==2.2.2
2 | Flask-Static-Digest==0.4.0
3 | Flask-SQLAlchemy==2.4.4
4 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:16
2 | MAINTAINER Benjamin Knox "bknox.contact@gmail.com"
3 |
4 | ENV LC_ALL C.UTF-8
5 | ENV LANG en_US.UTF-8
6 | ENV LANGUAGE en_US:en
7 | ENV TERM screen
8 |
9 | RUN useradd --user-group --create-home --shell /bin/false app-user
10 | # RUN wget -qO - https://raw.githubusercontent.com/yarnpkg/releases/gh-pages/debian/pubkey.gpg | apt-key add -
11 | RUN apt-get update
12 | RUN apt-get install -y python3 python3-venv python3-pip build-essential autoconf libtool pkg-config nasm
13 | RUN rm -rf /var/lib/apt/lists/*
14 |
15 | ENV HOME=/home/app-user
16 | WORKDIR $HOME/app
17 |
18 | COPY package*.json ./
19 |
20 | RUN chown -R app-user:app-user $HOME/*
21 | USER app-user
22 |
23 | RUN npm install
24 |
25 | ENV VIRTUAL_ENV=/home/app-user/env
26 | RUN python3 -m venv $VIRTUAL_ENV
27 | ENV PATH="$VIRTUAL_ENV/bin:$PATH"
28 |
29 | COPY .requirements .
30 | RUN pip3 install -r .requirements
31 |
32 | ADD . $HOME/app
33 |
34 | WORKDIR $HOME/app
35 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Benjamin Knox
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | Flask React
3 |
4 |
5 | Because getting started developing web apps with flask and react can be easier, this boilerplate for developing them exists. This is a docker-compose script that builds a flask API with a react front end. Built so you can get right to coding an app.
6 |
7 | 
8 |
9 | ## Usage
10 |
11 | To use Flask React pull the repository and open the repository root, then run this command:
12 | ```shell
13 | docker-compose up
14 | ```
15 |
16 | You should be able to go to http://localhost:5001 to see the front end after the initial build finishes. It's that simple.
17 |
--------------------------------------------------------------------------------
/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benjaminknox/flask-react/82337cd3c0f9e219e391b01e5b4f8492cea32195/__init__.py
--------------------------------------------------------------------------------
/api/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benjaminknox/flask-react/82337cd3c0f9e219e391b01e5b4f8492cea32195/api/__init__.py
--------------------------------------------------------------------------------
/api/v1/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benjaminknox/flask-react/82337cd3c0f9e219e391b01e5b4f8492cea32195/api/v1/__init__.py
--------------------------------------------------------------------------------
/api/v1/basic.py:
--------------------------------------------------------------------------------
1 | from models import Component
2 | from database import db_session, init_db
3 | from flask import Blueprint, render_template, jsonify, request
4 |
5 | basic_route = Blueprint('basic_route', __name__)
6 |
7 | def getComponent(componentRow):
8 | try:
9 | component = Component.query.filter(Component.name == componentRow.name).first()
10 |
11 | if(component is None):
12 | component = insertComponent(componentRow)
13 | except:
14 | component = insertComponent(componentRow)
15 |
16 | return component
17 |
18 | def insertComponent(componentRow):
19 | init_db()
20 | component = componentRow
21 |
22 | db_session.add(component)
23 | db_session.commit()
24 |
25 | @basic_route.route('/basic')
26 | def basic():
27 | component = getComponent(Component(
28 | 'basic',
29 | 'Hello World!!!!!!!',
30 | 'A boilerplate for a Flask and React app.',
31 | 'Now with Materiaul UI'
32 | ))
33 |
34 | return jsonify({
35 | 'header': component.header,
36 | 'body': component.body,
37 | 'tag': component.tag
38 | })
39 |
40 | @basic_route.route('/editor-content')
41 | def editorContent():
42 |
43 | component = getComponent(Component(
44 | 'editor',
45 | 'Comes With Quill',
46 | 'Quill is your powerful rich text editor
Post-ironic roof party anim et dreamcatcher. Sint id kale chips drinking vinegar palo santo proident veniam sriracha brunch photo booth man braid tbh flexitarian in. Semiotics umami mollit whatever knausgaard, single-origin coffee direct trade in tumblr normcore ennui quinoa. Esse fugiat in wolf raclette consequat.
Truffaut etsy synth, do tote bag intelligentsia bicycle rights farm-to-table cardigan raw denim id schlitz quinoa dreamcatcher. Esse raclette hell of air plant vape tempor deserunt. Raw denim eu pork belly, master cleanse.