Building E-commerce with Django integrated with MercadoPago API

Introduction

This ecommerce was developed mostly in Django with PostgreSQL database and aims to cover all the basic functionalities of an e-commerce from login and user registration to the payment of the products.

Technologies

The implementation was carried out using Python version 3.7 with the following main libraries:

  • django
  • mercadopago
  • pytest
  • coverage

Other languages/technologies used:

  • Front-end: Javascript/HTML/CSS
  • Docker

Structure

.
├── ecommerce                                                             # django project
│   ├── asgi.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── main_app                                                              # main django application
│   ├── templatetags
│   │   └── cart_template_tags.py
│   ├── tests
│   │   ├── factories.py
│   │   ├── test_cart.py
│   │   ├── test_models.py
│   │   ├── test_views.py
│   │   └── tests.py
│   ├── admin.py
│   ├── apps.py
│   ├── forms.py
│   ├── models.py
│   ├── urls.py
│   ├── utils.py
│   └── views.py
├── media_root                                                            # product image storage
├── mercadopago_payment                                                   # django application for payments (mercadopago)
│   ├── tests
│   │   ├── factories.py
│   │   ├── test_forms.py
│   │   ├── test_models.py
│   │   └── test_views.py
│   ├── admin.py
│   ├── apps.py
│   ├── forms.py
│   ├── middleware.py
│   ├── models.py
│   ├── urls.py
│   ├── utils.py
│   └── views.py
├── postgres_data                                                         # database
├── static                                                                # static file storage (css/js/...)
├── templates                                                             # front-end storage (html)
├── conftest.py                                                           # pytest fixture file
├── docker-compose.yaml                                                   # docker-compose
├── docker_entrypoint.sh                                                  # docker Entrypoint
├── Dockerfile                                                            # docker build file
├── environment.env                                                       # environment variables
├── manage.py
├── pytest.ini                                                            # pytest setup
├── README.md
└── requirements.txt                                                      # libraries

Running the project

To run the project it is necessary to have docker and docker-compose installed in your environment. But first it is necessary to fill the environment.env file in the project root.

# Command to build and execute:
$ docker-compose up

# Only build:
$ docker-compose build

# Turn-off command:
$ docker-compose down

From that point on, all containers will be available. To access the application, just open the address http://localhost:8000 in your browser.

Handling the project

  1. To add products to the store:
  2. Create a superuser:
# Create superuser (admin), run the command and fill username, email and password:
$ docker exec -ti web createsuperuser

3.   Open the browser and go to localhost:8000/admin, then login with the user created earlier.

4.   Once logged into the admin panel, go to Products and fill in the fields.

Configuring MercadoPago

  1. Create a MercadoPago account: https://www.mercadopago.com.br/developers
  2. Create test keys at: https://www.mercadopago.com.br/developers/panel/credentials
  3. Copy keys and fill in the environment.env: MERCADO_PAGO_PUBLIC_KEY and MERCADO_PAGO_ACCESS_TOKEN

NOTE: To put Mercadopago into production, activate the production credentials in the same link mentioned above and use the keys.

Development

The structure contained in the docker-compose.yaml file provides separate containers for the Django project and the database (PostgreSQL).

Database

All database-related changes must be made using Django's own ORM. To create a new migration just run docker exec -ti web python manage.py makemigrations and docker exec -ti web python manage.py migrate. The model diagram can be seen in the root directory of this project as database_diagram.png.

Command to generate database diagram (it needs django-extensions and pygraphviz libs):

$ docker exec -ti web python manage.py graph_models main_app mercadopago_payment -g -o database_diagram.png

Tests

To run the tests, simply enter the following commands in your terminal:

# Run the tests with coverage to generate the coverage report:
$ docker exec -ti web coverage run -m pytest -vx

# Display the report and list the lines that are not covered by the tests:
$ docker exec -ti web coverage report -i

To validate templates:

$ docker exec -ti web python manage.py validate_templates

This project currently contains 70% of test coverage.

Improvements that can be made

Download details:

Author: heldercelso
Source code: https://github.com/heldercelso/myecommerce
License:

#python #django

What is GEEK

Buddha Community

Building E-commerce with Django integrated with MercadoPago API
Einar  Hintz

Einar Hintz

1599364620

API Integration Practices and Patterns

We all hear it so often that we almost stop hearing it: “Integration is critical to meeting users’ needs.”

Integration work consumes 50%-80% of the time and budget of digital transformation projects, or building a digital platform, while innovation gets only the leftovers, according to SAP and Salesforce. And as everyone from legacy enterprises to SaaS startups launches new digital products, they all hit a point at which the product cannot unlock more value for users or continue to grow without making integration a feature.

If I were to sum up the one question behind all of the other questions that I hear from customers, enterprises, partners, and developers, it would be something like: “Is integration a differentiator that we should own? Or an undifferentiated but necessary feature that supports what we’re trying to accomplish?”

This Refcard won’t try to answer that question for you. Rather, no matter what type of development work you do, API integration is a fact of life today, like gravity. Why? Today, experience is paramount. The average enterprise uses more than 1,500 cloud applications (with the number growing by 20% each year). Every app needs to integrate with other systems in a fluid and ever-changing application ecosystem. So instead, I’ll share some of the common practices you’re likely to contend with as well as some patterns to consider.


This is a preview of the API Integrations Practices and Patterns Refcard. To read the entire Refcard, please download the PDF from the link above.

#apis #api integration #integration patterns #api cloud #api patterns #api authentication #api errors #apis and integrations

Top E-Commerce Mobile App Developers in USA

Looking to develop an E-Commerce app for your business or start-up? We at, AppClues Infotech have the best team of E-Commerce mobile app developers in USA for iOS & Android users. Get in touch with our E-Commerce experts to take your E-Commerce business to the next level.

E-Commerce App Development Services
• Ecommerce Technology Consulting
• Custom E-Commerce App Development
• E-Commerce Wallet Development
• E-Commerce Plugin Integration
• E-Commerce App UI/UX Designing
• B2B & B2C E-Commerce App Solutions

For more info:
Website: https://www.appcluesinfotech.com/
Email: info@appcluesinfotech.com
Call: +1-978-309-9910

#e-commerce app development company in usa #hire e-commerce app developers in usa #custom e-commerce app development #create an e-commerce app #cost to build e-commerce app #m-commerce app development company in usa

Top E-Commerce App Development Company in USA

Looking to develop an eCommerce app for your business? We at, AppClues Infotech provide the best eCommerce mobile app development services for Android and iOS users. Get in touch with our eCommerce experts to take your e-commerce business to the next level.

For more info:
Website: https://www.appcluesinfotech.com/
Email: info@appcluesinfotech.com
Call: +1-978-309-9910

#e-commerce app development company in usa #hire e-commerce app developers in usa #custom e-commerce app development #create an e-commerce app #cost to build e-commerce app #m-commerce app development company in usa

Autumn  Blick

Autumn Blick

1601381326

Public ASX100 APIs: The Essential List

We’ve conducted some initial research into the public APIs of the ASX100 because we regularly have conversations about what others are doing with their APIs and what best practices look like. Being able to point to good local examples and explain what is happening in Australia is a key part of this conversation.

Method

The method used for this initial research was to obtain a list of the ASX100 (as of 18 September 2020). Then work through each company looking at the following:

  1. Whether the company had a public API: this was found by googling “[company name] API” and “[company name] API developer” and “[company name] developer portal”. Sometimes the company’s website was navigated or searched.
  2. Some data points about the API were noted, such as the URL of the portal/documentation and the method they used to publish the API (portal, documentation, web page).
  3. Observations were recorded that piqued the interest of the researchers (you will find these below).
  4. Other notes were made to support future research.
  5. You will find a summary of the data in the infographic below.

Data

With regards to how the APIs are shared:

#api #api-development #api-analytics #apis #api-integration #api-testing #api-security #api-gateway

Ahebwe  Oscar

Ahebwe Oscar

1620177818

Django admin full Customization step by step

Welcome to my blog , hey everyone in this article you learn how to customize the Django app and view in the article you will know how to register  and unregister  models from the admin view how to add filtering how to add a custom input field, and a button that triggers an action on all objects and even how to change the look of your app and page using the Django suit package let’s get started.

Database

Custom Titles of Django Admin

Exclude in Django Admin

Fields in Django Admin

#django #create super user django #customize django admin dashboard #django admin #django admin custom field display #django admin customization #django admin full customization #django admin interface #django admin register all models #django customization