Git Product home page Git Product logo

challenge_3b_stores's Introduction

API 3B STORES

About The Project

Microservice allow Create, Edit Products and Create Orders

Built With

  • Language: Python 3.9.18
  • Framework: FastApi
  • ODM: mongoengine 0.23.1
challenge_3b_stores/
├── app/
│   ├── __init__.py
│   ├── api/
│   │   ├── __init__.py
│   │   └── v1/
│   │       ├── __init__.py
│   │       ├── serializer.py
│   │       └── views.py
│   │
│   ├── core/
│   │   ├── __init__.py
│   │   ├── constants.py
│   │   ├── exceptions.py
│   │   ├── handlers.py
│   │   ├── helpers.py
│   │   ├── models.py
│   │   ├── process.py
│   │   ├── querysets.py
│   │   └── workers.py
│   │
│   └── meta/
│       ├── __init__.py
│       └── views.py
│
├── config/
│   ├── __init__.py
│   ├── db.py
│   └── urls.py
│
├── docker/
│   ├── docker-compose.yml
│   └── Dockerfile
│
├── README.md
└── requirements.txt
└── .env.example

Getting Started

This is an example of how you may follow instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.

Prerequisites

Once you have MongoDB installed, and if you are going to run the project on local, please check that mongo is running in your pc with the next command, or maybe you should validate if you have installed docker and mongo dockerized:

sudo systemctl status mongod
sudo rm -rf /tmp/mongodb-27017.sock
sudo service mongod start
sudo systemctl status mongod
  • [Redis Installation]
sudo apt-get update
sudo apt-get install redis-server

Then run server redis

redis-server

Verified that run correctly redis server

redis-cli ping

If the server is up, you will receive a PONG response.

Installation

  1. Install the virtual environment
$ python3 -p python3 venv

Activate the virtual environment with:

$ source venv/bin/activate
  1. Install project requirements
$ pip3 install -r requirements.txt

Configuration

Set Project config

Env vars of external service:

ENV VAR VALUES
APP_ENV local, staging, production
TIMEZONE "Mexico/General"

Set Sentry config

Env vars of external service:

ENV VAR VALUES
SENTRY_DNS url sentry dns if you use senty in API

Set Database config

Env vars of external service:

ENV VAR VALUES
MONGO_URI Mongo URI

Set Celery config

Env vars of external service:

ENV VAR VALUES
CELERY_BROKER_URL url redis broker
CELERY_RESULT_BACKEND url redis result

Set AWS config

Env vars of external service:

ENV VAR VALUES
AWS_DEFAULT_REGION region of configure in you profile AWS e.g. us-west-2
AWS_ACCESS_KEY_ID access key id of you AWS account
AWS_SECRET_ACCESS_KEY secret access key in you AWS account

Execution

uvicorn Server

$ uvicorn config:app --host=0.0.0.0 --port=5000 --reload --log-level=info

celery

$ celery -A app.core.workers:celery_app worker --loglevel=info

Develop

Run Flake8

flake8 --exclude venv/ --max-line-length 120

or

python -m flake8 --exclude venv/ --max-line-length 120

Run Test

Execute

coverage run -m pytest

See more in htmlcov/index.html with your browser

Contact

  • José Nicolielly - - jcnil

challenge_3b_stores's People

Contributors

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