In this project, I designed a sample user interface requested by the P.I Works company. Its interface is from Django, the web development framework of the Python programming language.
- UI (Base Folder Of The Project)
- Static
- __init__.py
- asgi.py
- settings.py
- urls.py
- wsgi.py
- Products (App File)
- Admin Interface
- Run Server And Connect To The User Interface On The Local Host
- Python defines two types of packages, regular packages and namespace
packages. Regular packages are traditional packages as they existed
in Python 3.2 and earlier. A regular package is typically implemented
as a directory containing an init.py file. When a regular package
is imported, this init.py file is implicitly executed, and the
objects it defines are bound to names in the package’s namespace. The
init.py file can contain the same Python code that any other module can contain, and Python will add some additional attributes to
the module when it is imported.
- As well as WSGI, Django also supports deploying on ASGI, the emerging Python standard for asynchronous web servers and applications. Django’s startproject management command sets up a default ASGI configuration for you, which you can tweak as needed for your project, and direct any ASGI-compliant application server to use.
- It is the file that we edit the settings of functions and applications in the general structure of Django and edit when a new application is added. Since we designed a user interface in this project, I made some design applications using Django's ready-made applications.
- Here is the code that I wrote:
INSTALLED_APPS = [ 'admin_interface', 'colorfield', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'products' ]
- When a user requests a page from your Django-powered site, this is the algorithm the system follows to determine which Python code to execute: Django determines the root URLconf module to use. Ordinarily, this is the value of the ROOT_URLCONF setting, but if the incoming HttpRequest object has a urlconf attribute (set by middleware), its value will be used in place of the ROOT_URLCONF setting. Django loads that Python module and looks for the variable urlpatterns. This should be a sequence of django.urls.path() and/or django.urls.re_path() instances. Django runs through each URL pattern, in order, and stops at the first one that matches the requested URL, matching against path_info. Once one of the URL patterns matches, Django imports and calls the given view, which is a Python function (or a class-based view). The view gets passed the following arguments: An instance of HttpRequest. If the matched URL pattern contained no named groups, then the matches from the regular expression are provided as positional arguments. The keyword arguments are made up of any named parts matched by the path expression that are provided, overridden by any arguments specified in the optional kwargs argument to django.urls.path() or django.urls.re_path().
- Here is the code that I wrote `from django.contrib import admin from django.urls import path
urlpatterns = [ path('', admin.site.urls), ]
-
Django’s primary deployment platform is WSGI, the Python standard for web servers and applications.
-
Django’s startproject management command sets up a minimal default WSGI configuration for you, which you can tweak as needed for your project, and direct any WSGI-compliant application server to use.
-
Django’s primary deployment platform is WSGI, the Python standard for web servers and applications.
-
Django’s startproject management command sets up a minimal default WSGI configuration for you, which you can tweak as needed for your project, and direct any WSGI-compliant application server to use.
- This file manage the Django admin panel which is the include of all UI datas, database and methods
- This file, which is the main and the most important in the project, contains the user models and the methods that are set according to the dynamics of the project.
- In this file; If any apps is exists, we have to say the name to Django which app we want to add.
- In this file; If we want to make changes in an application we have written additionally, we set the necessary database registration operations, field types and display properties of these fields.
- If we want to test the features and functions in our project, we can write the codes that test all functions in this file. However I don't need to do any auto-tests in this project.
- When we want to change any action fields, form fields or any spesific fields, we can use this file. But ı didn't write any form or etc. in this project
- And finally let's reach the User Interface on the local host
- Firstly we must write a short and very simple code on the CMD or Terminal.
- Here is the code:
python manage.py runserver
- This code will be run our project on the local host and then we will see the Interface.
-
Username: superadmin
-
Password: ımsuperadmin
-
Then we can reach the main page of the interface
- We have a user models in here for ex. testuser and superadmin, also you can add and edit the user
- And also we have the products area. You can manage products and add the new products
-
In summary, in this project I designed a basic and simple User Interface (UI) design for that given to me assignment by P.I Works Inc.
-
For more project repos, you could visit my GIThub profile
-
Thank's for your times given to me.