Coder Social home page Coder Social logo

miniprogramstore / pyshop Goto Github PK

View Code? Open in Web Editor NEW

This project forked from garibaldiviolin/pyshop

0.0 1.0 0.0 412 KB

A Marketplace built with Python, Django Framework and Django REST Framework

Python 91.40% HTML 7.20% Shell 0.65% Batchfile 0.73% CSS 0.02%

pyshop's Introduction

PyShop

PyShop is a e-commerce website and REST API made in Python language, using Django and Django REST Framework.

Overview

PyShop website allows customers to search and buy products online, track progress and understand details of their orders. The platform also allows the managers to use the RESTAPI or a private section of the website (manually) to control the e-commerce data. As said above, the application was built in Python, using Django, Django REST Framework, and uses coverage to analyze how much code is covered by the unit tests (apps' tests directory).

Software Requirements

Although it is not necessary, it is highly recommended to use virtualenvwrapper in the steps below, since it isolates the project's environment, allowing the development of many different projects' versions with different dependencies' versions.

Installing Dependencies

# After navigating to the project pyshop/src directory, install virtualenvwrapper
$ pip install virtualenvwrapper
# Additional steps (only for Linux users)
$ export WORKON_HOME=~/Envs
$ mkdir -p $WORKON_HOME
$ source /usr/local/bin/virtualenvwrapper.sh
# Create isolated enviroment (using "pyshop" as the name for the environment)
$ mkvirtualenv pyshop
# Use the pyshop environment created
$ workon pyshop
# Install the requirements
$ pip install -r requirements.txt

Running the Project

# Use the pyshop environment
$ workon pyshop
# After navigating to the project pyshop/src directory, execute migrations
$ python manage.py migrate
# Start the server
$ python manage.py runserver

API Documentation

https://garibaldiviolin.github.io/pyshop/

Inserting sample data for tests

It is available in the project's directory a sample data to be used to manually test the website (via browser) and the REST API:

# Use the pyshop environment
$ workon pyshop
# After navigating to the project pyshop/src directory, execute migrations
$ python manage.py migrate
# Load the sample data
$ python manage.py loaddata sample_data.json
# Start the server
$ python manage.py runserver

Logging

PyShop uses python built-in logging library to trace and analyze incoming requests. By default, the log is disabled. To enable information logging, the application expects a configuration file (logging.conf) and the "logs" folder in the same directory as manage.py. There is a configuration file example (logging.conf_file) available in the project. Just rename this file to logging.conf, create the logs directory, restart the web server (python manage.py runserver), and a file will be created in the logs folder. The information level in this log depends on the configuration set in logging.conf.

Development Environment

  • Python 3.5.2
  • Django 2.0.7
  • Django Rest Framewok 3.8.2
  • Coverage.py 4.5.1
  • Sublime Text 3.1.1 with Anaconda (Python package)
  • Xubuntu GNU/Linux Operating System (16.04.5 LTS version)
  • SQLite DBMS (for production use, MySQL or PostgreSQL is recommended instead)

Running django unit tests

# After navigating to the project pyshop/src directory, execute tests
$ coverage run --source ./ ./manage.py test manager website -v 2
  • The command above uses coverage.py library to analyze how much code the tests executed can cover. If the tests were executed with no errors, then the command shell should show the following messages in the last lines shown in the terminal (the time period may have a different value on a different machine, and number of tests - "nn" in the following lines - may change depending on the application's version):
Ran nn tests in 0.455s

OK
Destroying test database for alias 'default'
  • To analyse how much these tests cover each python script from this project, execute the following command:
# Show each python script of the project and how much code is covered with the tests
$ coverage report

pyshop's People

Contributors

garibaldiviolin avatar

Watchers

James Cloos 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.