Giter Site home page Giter Site logo

server's Introduction

server

Flask + React

Description

Simple Flask React web application built with Flask-Bootstrap, Webpack and Yarn. Based on the work given by Angela Branaes: Building a Python ReactJS web application

Setup

PyEnv was used to select the proper Python version to be used along with VirtualEnv. The React part was integrated using NodeEnv.

Prerrequisites

Make sure to install and have a working Git and PyEnv environment and then with the help of PyEnv install Python versions 2.7.14 and 3.6.3, accordingly.

Installation

Please follow the next recommended sequence of general instructions to install this application:

git clone
cd server
pyenv virtualenv 2.7.14 server27 | pyenv virtualenv 3.6.3 server36
pyenv activate server27 | pyenv activate server36
pip install -r requirements.txt

Update .bashrc (Ubuntu)

Nodeenv has been installed via 'pip install -r requirements.txt', now we make sure the following is present at the end in the bash setup (.bashrc file):

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

To continue, refresh/rehash the shell.

Install yarn

We proceed to install the yarn node package manager, and also make sure the proper settings have been applied to the end of the bash setup (.bashrc file):

curl -o- -L https://yarnpkg.com/install.sh | bash

export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"

To continue, refresh/rehash the shell.

Install Node packages via yarn

Proceed to install all needed React dependencies:

cd application/static
yarn install
yarn build
cd ../../..

Run server

To run the server, make sure you have the instance folder with the config.py file settings needed, before you start the sever:

mkdir instance
cd instance
touch config.py

With your favorite editor add the following settings accordingly:

CONFIG = 'INSTANCE'
SECRET_KEY = 'some-secret-key'
SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/server.db'
SQLALCHEMY_TRACK_MODIFICATIONS = False

SECURITY_PASSWORD_HASH = 'bcrypt'
SECURITY_PASSWORD_SALT = 'some-password-salt'

SUPER_ROLE = 'super'
SUPER_ROLE_DESCRIPTION = 'Super User'
SUPER_PASSWORD = 'superuser'
SUPER_EMAIL = '[email protected]'
ADMIN_ROLE = 'admin'
ADMIN_ROLE_DESCRIPTION = 'Administrador'
ADMIN_PASSWORD = 'adminuser'
ADMIN_EMAIL = '[email protected]'

SECURITY_EMAIL_SENDER = 'no-reply@localhost'
MAIL_SERVER = 'localhost'
MAIL_PORT = 465
MAIL_USE_TLS = True
MAIL_USE_SSL = False
MAIL_USERNAME = some-user
MAIL_PASSWORD = some-password

Then start the server:

./start

React autobuild

While developing React components, you can use the auto build feature by:

cd application/templates/static
yarn watch

Logging

The built in logging feature using JSON can be monitered as well:

tail -f /tmp/server_development_json.log

NOTES

The SQLite file location is setup via the instance configuration settings. The logging file location is setup via the different config files for:

- development
- stagging
- production

server's People

Contributors

fbenavides69 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.