Coder Social home page Coder Social logo

henrymbuguak / shopping-cart-using-django-2.0-and-python-3.6 Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 3.0 345 KB

This is a shopping created using Django 2.0 and Python 3.6

Python 54.98% CSS 2.71% HTML 42.31%
shopping-cart python django-migrations situations database

shopping-cart-using-django-2.0-and-python-3.6's Introduction

Welcome to Online Shopping Cart


This is a guide on how to set up the project on your localhost for development.

Introduction

Online Shopping Cart is running on Django Web framework and Python programming language.

Specific Technologies
  1. Django Web Framework(Django version 2.0)
  2. Python 3.6.3
Environment Setup

We are assuming that you are using linux based system for your software development. It is recommended that you create a python virtual environment for this project. Ensure that you have installed python 3.6 on your machine. To create your python virtual environment run the following command:

  • virtualenv -p /usr/bin/python3.6 my_project

The above command will create virtual environment with the name my_project. After creating virtual environment, you need to activate the environment by running this command:

  • source my_project/bin/activate

The above command will activate your virtual environment. That's it!

While the virtual environment is still active, time to clone the help project. Run the following command:

After cloning the project, a folder with name shopping_cart will be created. Type the following command: cd shopping_cart to navigate into the project folder.You need to install project dependencies. Run the following command:

  • pip install -r requirements.txt

The above command will install all requirements. The next thing is to configure your database. This can be done in the settings.py file.

Database Migrations

After sorting your database settings. You need to run migrations, to do this, run the following command:

  • python manage.py makemigrations

The above command will create migrations but tables are not created yet. To actually create tables in the database, run the following command:

  • python manage.py migrate
Important Commands

Sometimes you may find yourself in a situation where you need to delete data in your tables. This can be achieved by running the following command:

  • python manage.py sqlflush | python manage.py dbshell

The above command is very dangerous because you loose data. Use it at your own RISK

You may find yourself in situation where you have made changes to your models but when you try to run python manage.py makemigrations Django migrations system does not detect any changes. Well, Django tracks your migrations in a folder called migrations. To overcome the problem of no changes detected, run the following commands:

  • find . -path "/migrations/.py" -not -name "init.py" -delete
  • find . -path "/migrations/.pyc" -delete

The above command should be used when your project is under development environment. Of course there's better ways to solve this. Now you can run your migration commands and it should work.

Learn more about Django Migrations System

shopping-cart-using-django-2.0-and-python-3.6's People

Contributors

henrymbuguak avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

shopping-cart-using-django-2.0-and-python-3.6's Issues

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.