Giter VIP home page Giter VIP logo

baseflask's Introduction

MyFirstPythonServer

A basic implementation for my first python server which is gonna be a chat with an authorization. All in one script server using Flask as a web server and SQLite3 as a Data Base.

Python version 3.7+ is required. As well as the virtualenv module.

How to start

  1. Create and activate a python environment

python3 -m venv .env && source .env/bin/activate

(For later deactivation run)

deactivate

  1. Install all the project dependencies

pip install -r requirements.txt

  1. Init db by running the following script

python init_db.py

  1. Start the App as a service using flask

env FLASK_APP=server.py flask run

How to test

It's an backend API service which response in the JSON format. So it works better with a Frontent part.

But you can do queries just using your browser. For example

For logging in you can open in a browser the following link

http://localhost:5000/login

The system will authorize you as a random user from DB (Anthony or Yan) and remember your session.

To see your chats list please open the following. Must be logged in first!

http://localhost:5000/mychats

To see chat messages for a Chat #1 open

http://localhost:5000/chat-messages?chat_id=1

To add message to the Chat #1 do

http://localhost:5000/chat-post-message?chat_id=1&text=Some%20text%20here

ETC

baseflask's People

Contributors

armalon avatar

Watchers

 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.