This commit is contained in:
commit
06ced215da
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"python.pythonPath": "C:\\ProgramData\\Anaconda3\\python.exe",
|
||||
"python.dataScience.jupyterServerURI": "local"
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,8 @@
|
|||
from django.contrib import admin
|
||||
from .models import User
|
||||
from .models import AuctionListing
|
||||
|
||||
# Register your models here.
|
||||
admin.site.register(User)
|
||||
admin.site.register(AuctionListing)
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class AuctionsConfig(AppConfig):
|
||||
name = 'auctions'
|
|
@ -0,0 +1,63 @@
|
|||
# Generated by Django 3.0.8 on 2020-10-18 16:09
|
||||
|
||||
from django.conf import settings
|
||||
import django.contrib.auth.models
|
||||
import django.contrib.auth.validators
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('auth', '0011_update_proxy_permissions'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='User',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('password', models.CharField(max_length=128, verbose_name='password')),
|
||||
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
|
||||
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
|
||||
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
|
||||
('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
|
||||
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
|
||||
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
|
||||
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
|
||||
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
|
||||
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
|
||||
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
|
||||
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'user',
|
||||
'verbose_name_plural': 'users',
|
||||
'abstract': False,
|
||||
},
|
||||
managers=[
|
||||
('objects', django.contrib.auth.models.UserManager()),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='AuctionListing',
|
||||
fields=[
|
||||
('title', models.CharField(max_length=64, primary_key=True, serialize=False)),
|
||||
('price', models.DecimalField(decimal_places=2, max_digits=10)),
|
||||
('desc', models.CharField(max_length=1000)),
|
||||
('picture', models.URLField(null=True)),
|
||||
('category', models.CharField(max_length=64)),
|
||||
('date_added', models.DateTimeField(auto_now_add=True)),
|
||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='user',
|
||||
name='watchlist',
|
||||
field=models.ManyToManyField(blank=True, related_name='watchlist', to='auctions.AuctionListing'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,17 @@
|
|||
# Generated by Django 3.0.8 on 2020-10-18 16:16
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('auctions', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='auctionlisting',
|
||||
name='date_added',
|
||||
),
|
||||
]
|
|
@ -0,0 +1,20 @@
|
|||
# Generated by Django 3.0.8 on 2020-10-18 16:18
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.utils.timezone
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('auctions', '0002_remove_auctionlisting_date_added'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='auctionlisting',
|
||||
name='date_added',
|
||||
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,21 @@
|
|||
from django.contrib.auth.models import AbstractUser
|
||||
from django.db import models
|
||||
|
||||
class User(AbstractUser):
|
||||
watchlist = models.ManyToManyField('AuctionListing',blank = True,related_name="watchlist")
|
||||
|
||||
class AuctionListing(models.Model):
|
||||
title = models.CharField(max_length = 64,primary_key = True)
|
||||
user = models.ForeignKey(User,on_delete = models.CASCADE)
|
||||
price = models.DecimalField(max_digits = 10,decimal_places = 2)
|
||||
desc = models.CharField(max_length = 1000)
|
||||
picture = models.URLField(null=True)
|
||||
category = models.CharField(max_length = 64)
|
||||
date_added = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.title}: {self.price},{self.desc},{self.picture},{self.category},{self.date_added}"
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
padding: 10px;
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
{% extends "auctions/layout.html"%}
|
||||
|
||||
{% block body %}
|
||||
<h2>Listings under category: {{ cat_name }}</h2>
|
||||
<div class="row">
|
||||
{% for list in listings %}
|
||||
<div class="col-sm-3">
|
||||
<a href="listing/{{ list.title}}" style = "color:inherit;text-decoration: none;">
|
||||
<div class="card border-light" style="width: 18rem;">
|
||||
<div class="shadow p-2 mb-2 bg-white rounded">
|
||||
<img class="card-img-top" src="{{ list.picture }}" alt="Preview not found">
|
||||
|
||||
<hr>
|
||||
<div class="card-body">
|
||||
<h4>{{ list.title }}</h4><br>
|
||||
|
||||
|
||||
<p class="card-text" style="font-size: large;">
|
||||
<b>bid price</b> : ${{list.price}}<br>
|
||||
<b>created by</b>: {{list.user}}
|
||||
</p>
|
||||
<div class = "text-right">
|
||||
<input class="form-check-input" type="checkbox" value="" id="watch">
|
||||
<label class="form-check-label" for="watch">Watch this item</label>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -0,0 +1,19 @@
|
|||
{% extends "auctions/layout.html" %}
|
||||
|
||||
{% block body %}
|
||||
<div class="jumbotron jumbotron-fluid">
|
||||
<div class="container">
|
||||
<h1 class="display-4">Categories</h1>
|
||||
<p class="lead">Select category to browse through listings</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-group">
|
||||
<a href="#" class="list-group-item list-group-item-action active">
|
||||
Select any one of the following
|
||||
</a>
|
||||
{% for cat in categories %}
|
||||
<a href="category/{{cat}}" class="list-group-item list-group-item-action">{{cat}}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,34 @@
|
|||
{% extends "auctions/layout.html" %}
|
||||
|
||||
{% block body %}
|
||||
|
||||
<h2>Create Listing</h2>
|
||||
|
||||
|
||||
<form action="{% url 'create' %}" method="post">
|
||||
{% csrf_token %}
|
||||
<div class="form-group">
|
||||
<input class="form-control" autofocus type="text" name="title" placeholder="title">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="text" name="desc" placeholder="Description">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="number" name="starting_bid" placeholder="starting bid">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="url" name="photo" placeholder="Picture(Optional)">
|
||||
</div>
|
||||
<div class ="form-group">
|
||||
<select class="form-control" name = "category" placeholder = "Category">
|
||||
<option selected disabled>Select a Category</option>
|
||||
{% for cat in categories %}
|
||||
<option value="{{cat}}">{{cat}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<input class="btn btn-primary" type="submit" value="Create Listing">
|
||||
</form>
|
||||
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,40 @@
|
|||
{% extends "auctions/layout.html" %}
|
||||
|
||||
{% block body %}
|
||||
<h2>Active Listings</h2>
|
||||
<div class="row">
|
||||
{% for listing in Listings %}
|
||||
<div class="col-sm-3">
|
||||
<a href="listing/{{ listing.title}}" style = "color:inherit;text-decoration: none;">
|
||||
<div class="card border-light" style="width: 18rem;">
|
||||
<div class="shadow p-2 mb-2 bg-white rounded">
|
||||
<img class="card-img-top" src="{{ listing.picture }}" alt="Preview not found">
|
||||
|
||||
<hr>
|
||||
<div class="card-body">
|
||||
<h4>{{ listing.title }}</h4><br>
|
||||
|
||||
|
||||
<p class="card-text" style="font-size: large;">
|
||||
<b>bid price</b> : ${{listing.price}}<br>
|
||||
<b>created by</b>: {{listing.user}}
|
||||
</p>
|
||||
<div class = "text-right">
|
||||
<form action = "{% url 'index' %}" method="POST">
|
||||
{% csrf_token %}
|
||||
{{ watch_form }}
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,49 @@
|
|||
{% load static %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>{% block title %}Auctions{% endblock %}</title>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
|
||||
<link href="{% static 'auctions/styles.css' %}" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Auctions</h1>
|
||||
<div style = "align-self: flex-end;">
|
||||
{% if user.is_authenticated %}
|
||||
Signed in as <strong>{{ user.username }}</strong>.
|
||||
{% else %}
|
||||
Not signed in.
|
||||
{% endif %}
|
||||
</div>
|
||||
<ul class="nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'index' %}">Active Listings</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'categories' %}">Categories</a>
|
||||
</li>
|
||||
{% if user.is_authenticated %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'wishlist' %}">WishList</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'create' %}">Create Listing</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'logout' %}">Log Out</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'login' %}">Log In</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'register' %}">Register</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<hr>
|
||||
{% block body %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
{% extends "auctions/layout.html" %}
|
||||
|
||||
{% block body %}
|
||||
<h2>Listing:{{ Listing.title}}</h2>
|
||||
|
||||
<img src = "{{Listing.picture}}"></img>
|
||||
|
||||
<p>{{Listing.desc}}</p>
|
||||
|
||||
<h3>${{Listing.price}}</h3>
|
||||
bids so far
|
||||
<div class="form-group">
|
||||
<input class="form-control" autofocus type="number" name="bid" placeholder="Bid">
|
||||
</div>
|
||||
<input class="btn btn-primary" type="submit" value="Place Bid">
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,24 @@
|
|||
{% extends "auctions/layout.html" %}
|
||||
|
||||
{% block body %}
|
||||
|
||||
<h2>Login</h2>
|
||||
|
||||
{% if message %}
|
||||
<div>{{ message }}</div>
|
||||
{% endif %}
|
||||
|
||||
<form action="{% url 'login' %}" method="post">
|
||||
{% csrf_token %}
|
||||
<div class="form-group">
|
||||
<input autofocus class="form-control" type="text" name="username" placeholder="Username">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="password" name="password" placeholder="Password">
|
||||
</div>
|
||||
<input class="btn btn-primary" type="submit" value="Login">
|
||||
</form>
|
||||
|
||||
Don't have an account? <a href="{% url 'register' %}">Register here.</a>
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,30 @@
|
|||
{% extends "auctions/layout.html" %}
|
||||
|
||||
{% block body %}
|
||||
|
||||
<h2>Register</h2>
|
||||
|
||||
{% if message %}
|
||||
<div>{{ message }}</div>
|
||||
{% endif %}
|
||||
|
||||
<form action="{% url 'register' %}" method="post">
|
||||
{% csrf_token %}
|
||||
<div class="form-group">
|
||||
<input class="form-control" autofocus type="text" name="username" placeholder="Username">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="email" name="email" placeholder="Email Address">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="password" name="password" placeholder="Password">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="password" name="confirmation" placeholder="Confirm Password">
|
||||
</div>
|
||||
<input class="btn btn-primary" type="submit" value="Register">
|
||||
</form>
|
||||
|
||||
Already have an account? <a href="{% url 'login' %}">Log In here.</a>
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
|
@ -0,0 +1,15 @@
|
|||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.index, name="index"),
|
||||
path("login", views.login_view, name="login"),
|
||||
path("logout", views.logout_view, name="logout"),
|
||||
path("register", views.register, name="register"),
|
||||
path("wishlist", views.register, name="wishlist"),
|
||||
path("create", views.create, name="create"),
|
||||
path("categories", views.category, name="categories"),
|
||||
path("category/<str:cat_name>",views.category,name="indiv_categories"),
|
||||
path("listing/<str:title>",views.listing,name="listing")
|
||||
]
|
|
@ -0,0 +1,130 @@
|
|||
from django.contrib.auth import authenticate, login, logout
|
||||
from django.db import IntegrityError
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import render
|
||||
from django.urls import reverse
|
||||
from django import forms
|
||||
from .models import User,AuctionListing
|
||||
|
||||
|
||||
categories = ['Fashion','Electronics','Home','Sports','Toys','Automobile','Books','Video Games', 'Other']
|
||||
class Watch_Form(forms.Form):
|
||||
watch_this = forms.BooleanField(required=False)
|
||||
class Bid_Form(forms.Form):
|
||||
bid = 0.0
|
||||
def __init__(self,bid_value):
|
||||
self.bid = bid_value
|
||||
|
||||
bid_value = forms.DecimalField(decimal_places=2,min_value= bid + 1)
|
||||
|
||||
|
||||
def index(request):
|
||||
listings = AuctionListing.objects.all()
|
||||
watch_form = Watch_Form(request.POST)
|
||||
if watch_form.is_valid():
|
||||
print("asdf")
|
||||
watch = watch_form.cleaned_data["watch_this"]
|
||||
print(watch)
|
||||
|
||||
|
||||
|
||||
return render(request, "auctions/index.html",{
|
||||
"Listings":listings,
|
||||
"watch_form": Watch_Form()
|
||||
})
|
||||
|
||||
def listing(request,title):
|
||||
"""
|
||||
docstring
|
||||
"""
|
||||
listings = AuctionListing.objects.get(pk = title)
|
||||
return render(request,"auctions/listing.html",{
|
||||
"Listing": listings
|
||||
})
|
||||
def category(request,cat_name = None):
|
||||
"""
|
||||
docstring
|
||||
"""
|
||||
if( cat_name != None):
|
||||
if cat_name.capitalize() in categories:
|
||||
|
||||
listings = AuctionListing.objects.filter(category=cat_name.capitalize())
|
||||
print(listings)
|
||||
|
||||
return render(request, "auctions/category.html",{
|
||||
"listings":listings,
|
||||
"cat_name": cat_name
|
||||
|
||||
})
|
||||
|
||||
else:
|
||||
return render(request,"auctions/category_listing.html",{
|
||||
"categories": categories
|
||||
})
|
||||
def login_view(request):
|
||||
if request.method == "POST":
|
||||
|
||||
# Attempt to sign user in
|
||||
username = request.POST["username"]
|
||||
password = request.POST["password"]
|
||||
user = authenticate(request, username=username, password=password)
|
||||
|
||||
# Check if authentication successful
|
||||
if user is not None:
|
||||
login(request, user)
|
||||
return HttpResponseRedirect(reverse("index"))
|
||||
else:
|
||||
return render(request, "auctions/login.html", {
|
||||
"message": "Invalid username and/or password."
|
||||
})
|
||||
else:
|
||||
return render(request, "auctions/login.html")
|
||||
|
||||
|
||||
def logout_view(request):
|
||||
logout(request)
|
||||
return HttpResponseRedirect(reverse("index"))
|
||||
|
||||
|
||||
def register(request):
|
||||
if request.method == "POST":
|
||||
username = request.POST["username"]
|
||||
email = request.POST["email"]
|
||||
|
||||
# Ensure password matches confirmation
|
||||
password = request.POST["password"]
|
||||
confirmation = request.POST["confirmation"]
|
||||
if password != confirmation:
|
||||
return render(request, "auctions/register.html", {
|
||||
"message": "Passwords must match."
|
||||
})
|
||||
|
||||
# Attempt to create new user
|
||||
try:
|
||||
user = User.objects.create_user(username, email, password)
|
||||
user.save()
|
||||
except IntegrityError:
|
||||
return render(request, "auctions/register.html", {
|
||||
"message": "Username already taken."
|
||||
})
|
||||
login(request, user)
|
||||
return HttpResponseRedirect(reverse("index"))
|
||||
else:
|
||||
return render(request, "auctions/register.html")
|
||||
def create(request):
|
||||
"""
|
||||
docstring
|
||||
"""
|
||||
if request.method == "POST":
|
||||
title = request.POST["title"]
|
||||
desc = request.POST["desc"]
|
||||
starting_bid = request.POST["starting_bid"]
|
||||
photo_url = request.POST["photo"]
|
||||
category = request.POST["category"]
|
||||
obj = AuctionListing(title = title, desc = desc, user = request.user,price = starting_bid, picture = photo_url,category=category)
|
||||
obj.save()
|
||||
return render(request,"auctions/index.html")
|
||||
else:
|
||||
return render(request,"auctions/create_listing.html",{
|
||||
"categories":categories
|
||||
})
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,16 @@
|
|||
"""
|
||||
ASGI config for commerce project.
|
||||
|
||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'commerce.settings')
|
||||
|
||||
application = get_asgi_application()
|
|
@ -0,0 +1,122 @@
|
|||
"""
|
||||
Django settings for commerce project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 3.0.2.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/3.0/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/3.0/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = '6ps8j!crjgrxt34cqbqn7x&b3y%(fny8k8nh21+qa)%ws3fh!q'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'auctions',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'commerce.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'commerce.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
}
|
||||
}
|
||||
|
||||
AUTH_USER_MODEL = 'auctions.User'
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/3.0/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_L10N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/3.0/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
|
@ -0,0 +1,22 @@
|
|||
"""commerce URL Configuration
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/3.0/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
|
||||
urlpatterns = [
|
||||
path("admin/", admin.site.urls),
|
||||
path("", include("auctions.urls"))
|
||||
]
|
|
@ -0,0 +1,16 @@
|
|||
"""
|
||||
WSGI config for commerce project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'commerce.settings')
|
||||
|
||||
application = get_wsgi_application()
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env python
|
||||
"""Django's command-line utility for administrative tasks."""
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'commerce.settings')
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
"available on your PYTHONPATH environment variable? Did you "
|
||||
"forget to activate a virtual environment?"
|
||||
) from exc
|
||||
execute_from_command_line(sys.argv)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Reference in New Issue