This e-commerce project is full solution for any kind of e-commerce business.I used in this project django as framework and sslcommerz as payment. SSLCOMMERZ for bangladesh payment system.If you want i will implement any kind of payment gateway in this project, like Paypal, Stripe, Nochex etc.
In this project i used four apps, media folder, static folder, templates and others pip library/packages, And most important sslcommerz for payment system.
Django-crispy-forms supports several frontend frameworks, such as Twitter Bootstrap (versions 2, 3, and 4), Uni-form and Foundation. You can also easily adapt your custom company's one, creating your own, see the docs for more information. You can easily switch among them using CRISPY_TEMPLATE_PACK setting variable.
Install latest stable version into your python environment using pip:
- pip install django-crispy-forms
If you want to install development version (unstable), you can do so doing:
- pip install git+git://github.com/django-crispy-forms/django-crispy-forms.git@dev#egg=django-crispy-forms
Once installed add crispy_forms to your INSTALLED_APPS in settings.py:
INSTALLED_APPS = (
...
'crispy_forms',
)
For add template packs within django-crispy-forms:
#bootstrap, bootstrap3, bootstrap4, uni-from
CRISPY_TEMPLATE_PACK = 'bootstrap4'
In Django, files which are uploaded by the user are called Media or Media Files. Here are some examples:
- A user uploaded image, pdfs, doc files etc while publishing a post.
- Images of products in an e-commerce site.
- User's profile image. etc...
Just as with static files, to serve media files we have do add some configurations in our settings.py file.
Media files depend upon two configurations,
- MEDIA_ROOT,
- MEDIA_URL
In settings.py file:
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
In the main project urls.py file:
from django.conf.urls import url, include
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
url(r'^admin/', admin.site.urls),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
In static folder we store our all of css, js, bootstrap file to use those file in our project.
Settings added
from django.conf import settings
static and static_url added
from django.conf.urls.static import static
for load static folder in templates
{% load static %}
In this project i used four web-app this are App_Login, App_Shop, App_Order & App_Payment. And database i used in this project is sqlite-3.
-
App-Login:
- In app-login i make a fully custom model for login and registation. Where i create one custom model name is Profile and it is connected with User model by One To One connection.
- Also I used email as a unique field for this project. For unique email i need to customize Django user model.I used BaseUserManager, AbstractBaseUser, PermissionsMixin for customized user model.
- In app-login i also used two custom forms for profile model and user login model. The forms are Sign-Up-Form and Profile-Form.
- For Sign-Up-Form I also used Django auth class UserCreationForm.
- Though, it's a e-commerce project, so that I used email and password for login and registation.And all others profile things need to update after login.
-
App-Shop:
- In app-shop I create two custom model. One of Category and other on is Product.
- Category model used for make product in Category wise. example: Food, Clothing, Music etc.
- Product model used for store all kind of product details.
- Relationship in Category and Product is (Category-<Product One-To-Many) .
-
App-Order:
- In app-order I create two model for store ordering data.
- The models are Cart model and Order model.
- In django there are no custem cart for using cart to e-commerce I created cart model.
- Relationship in Cart and Order is (Cart>-<Order Many-To-Many) .
- Order model used to store order full information with payment id.
-
App-Payment:
- In app-payment i create one model for store billing information.
- Model Billing Address is for app-payment.