Giter Club home page Giter Club logo

api-project-using-python's Introduction

A basic Python Project

Disclaimer: This project doesn't have any authentication method for security.

Side Technologies
Frontend ReactJS - Redux - Axios
Backend Python - Flask
Database MySQL

Requirement

You should install and use these requirements before use this project.

Requirement Version
NodeJS 16.20.0+
NPM 8.19.4+
Python 3.10+
MySQL 5.5 or 5.6 or 5.7

How to use?

You can follow these steps to start the application.

Virtual environments

  • in macOS/Linux:
$ pip install virtualenv
$ python3 -m venv venv
$ . venv/bin/activate
  • in Windows:
$ pip install virtualenv
$ py -3 -m venv .venv
$ .venv\Scripts\activate

Install all project dependencies using:

$ pip install -r requirements.txt
$ cd frontend/
$ npm install

Edit your env.py

Open env.py and edit SQLALCHEMY_DATABASE_URI based on your mysql database information.

It should be like this example: mysql://username:password@server/db

Note: make sure your MySQL is running and works.

Run the migrations

$ flask db upgrade head

Run the Flask server

$ flask run --host=0.0.0.0

Run the React.js application

Note: make sure you are in the frontend directory.

$ npm start

Running ports and urls

By default, your backend server is running at 127.0.0.1:5000 and your frontend is running at 127.0.0.1:3000.

If you changed the server address you should change let apiPrefix = "http://localhost:5000/api" in the redux actions.

APIs

URL Method Input Params Success Output Errors
/api/login POST {"username": username} {"status": true, "user": userData} 404 If user not found and 500 for server errors
/api/register POST {"username": username, "fullname": fullname, "email": email} {"status": true, "user": userData} 403 If user exists and 500 for server errors
/api/picture GET user_id: userId, page: requestedPageNumber {"status": true, "pictures": picturesList} 404 If not exists and 500 for server errors
/api/picture POST formData(username: username, picture: pictureFile) {"status": true, "picture": pictureData} 404 If the user not exists and 500 for server errors

api-project-using-python's People

Contributors

majidend avatar

Stargazers

Mehdi 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.