Make an online shopping database using django and sqlite

 


Hey guys once again welcome to the Decoders blog, I hope you all are doing well and today I'm present with a online shopping database using django and sqlite

Here is an overview of how your database is gonna look like..........




STEP-1:  Create the server and all the setup files using django 

make one main file and within it 2 apps here I've made myserver as the main project and site1 and site2 are the respective apps

COMMAND FOR MAKING APPS: "django-admin startapp site1"


STEP-2: After make some changes in the files as given below:

views.py of site1:

from django.shortcuts import render
from django.http import HttpResponse
def index(request):
return HttpResponse("this is site1")


#urls.py of site1:
from django.contrib import admin
from django.urls import path
from . import views

urlpatterns = [
path('',views.index, name='index'),
]


#models.py of site1:
from django.db import models

# Create your models here.
class my_cart(models.Model):
name = models.CharField(max_length=20)
product_name=models.CharField(max_length=30)
adress= models.CharField(max_length=50)
contact_number=models.IntegerField()

STEP-3: Now enter another command "python3 manage.py migrate"
after this enter "python3 manage.py makemigrations"
then again enter "python3 manage.py migrate"


STEP-4: Now enter the command "python3 manage.py createsuperuser"
then enter the username and your password and after this run the server and you
will get your database ready!!!!



Comments

Post a Comment

Popular Posts