├── .idea ├── .name ├── vcs.xml ├── misc.xml ├── .gitignore ├── inspectionProfiles │ └── profiles_settings.xml ├── modules.xml ├── Learning_django.iml └── dataSources.xml ├── myapp ├── myapp │ ├── __init__.py │ ├── __pycache__ │ │ ├── urls.cpython-311.pyc │ │ ├── wsgi.cpython-311.pyc │ │ ├── views.cpython-311.pyc │ │ ├── __init__.cpython-311.pyc │ │ └── settings.cpython-311.pyc │ ├── asgi.py │ ├── wsgi.py │ ├── urls.py │ ├── views.py │ └── settings.py ├── website │ ├── __init__.py │ ├── migrations │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-311.pyc │ │ │ └── 0001_initial.cpython-311.pyc │ │ └── 0001_initial.py │ ├── admin.py │ ├── tests.py │ ├── views.py │ ├── __pycache__ │ │ ├── apps.cpython-311.pyc │ │ ├── admin.cpython-311.pyc │ │ ├── models.cpython-311.pyc │ │ └── __init__.cpython-311.pyc │ ├── apps.py │ └── models.py ├── db.sqlite3 ├── templates │ ├── nav.html │ ├── about.html │ ├── service.html │ └── home.html └── manage.py └── README.md /.idea/.name: -------------------------------------------------------------------------------- 1 | manage.py -------------------------------------------------------------------------------- /myapp/myapp/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /myapp/website/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /myapp/website/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /myapp/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shubh2-0/Learning_django/HEAD/myapp/db.sqlite3 -------------------------------------------------------------------------------- /myapp/website/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /myapp/website/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /myapp/website/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /myapp/myapp/__pycache__/urls.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shubh2-0/Learning_django/HEAD/myapp/myapp/__pycache__/urls.cpython-311.pyc -------------------------------------------------------------------------------- /myapp/myapp/__pycache__/wsgi.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shubh2-0/Learning_django/HEAD/myapp/myapp/__pycache__/wsgi.cpython-311.pyc -------------------------------------------------------------------------------- /myapp/myapp/__pycache__/views.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shubh2-0/Learning_django/HEAD/myapp/myapp/__pycache__/views.cpython-311.pyc -------------------------------------------------------------------------------- /myapp/website/__pycache__/apps.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shubh2-0/Learning_django/HEAD/myapp/website/__pycache__/apps.cpython-311.pyc -------------------------------------------------------------------------------- /myapp/myapp/__pycache__/__init__.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shubh2-0/Learning_django/HEAD/myapp/myapp/__pycache__/__init__.cpython-311.pyc -------------------------------------------------------------------------------- /myapp/myapp/__pycache__/settings.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shubh2-0/Learning_django/HEAD/myapp/myapp/__pycache__/settings.cpython-311.pyc -------------------------------------------------------------------------------- /myapp/website/__pycache__/admin.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shubh2-0/Learning_django/HEAD/myapp/website/__pycache__/admin.cpython-311.pyc -------------------------------------------------------------------------------- /myapp/website/__pycache__/models.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shubh2-0/Learning_django/HEAD/myapp/website/__pycache__/models.cpython-311.pyc -------------------------------------------------------------------------------- /myapp/website/__pycache__/__init__.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shubh2-0/Learning_django/HEAD/myapp/website/__pycache__/__init__.cpython-311.pyc -------------------------------------------------------------------------------- /myapp/website/migrations/__pycache__/__init__.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shubh2-0/Learning_django/HEAD/myapp/website/migrations/__pycache__/__init__.cpython-311.pyc -------------------------------------------------------------------------------- /myapp/templates/nav.html: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /myapp/website/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class WebsiteConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'website' 7 | -------------------------------------------------------------------------------- /myapp/website/migrations/__pycache__/0001_initial.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shubh2-0/Learning_django/HEAD/myapp/website/migrations/__pycache__/0001_initial.cpython-311.pyc -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /myapp/website/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | class Student(models.Model): 5 | name=models.CharField(max_length=200) 6 | college=models.CharField(max_length=300) 7 | age=models.IntegerField(max_length=10) 8 | is_active=models.BooleanField(default=False) -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /myapp/myapp/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for myapp project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myapp.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /myapp/myapp/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for myapp project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myapp.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /.idea/Learning_django.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | -------------------------------------------------------------------------------- /.idea/dataSources.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | sqlite.xerial 6 | true 7 | org.sqlite.JDBC 8 | jdbc:sqlite:C:\Users\shubh\OneDrive\Desktop\Learning_django\myapp\db.sqlite3 9 | $ProjectFileDir$ 10 | 11 | 12 | -------------------------------------------------------------------------------- /myapp/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myapp.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /myapp/website/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.2.4 on 2023-08-30 23:19 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Student', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('name', models.CharField(max_length=200)), 19 | ('college', models.CharField(max_length=300)), 20 | ('age', models.IntegerField(max_length=10)), 21 | ('is_active', models.BooleanField(default=False)), 22 | ], 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /myapp/templates/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {% include 'nav.html' %} 10 |

THIS IS ABOUT PAGE

11 |

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit 12 | amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper 13 | congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl 14 | sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque 15 | congue.

16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /myapp/templates/service.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {% include 'nav.html' %} 10 |

THIS IS SERVICE PAGE

11 |

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit 12 | amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, 13 | semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum 14 | diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. 15 | Pellentesque congue.

16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /myapp/myapp/urls.py: -------------------------------------------------------------------------------- 1 | """ 2 | URL configuration for myapp project. 3 | 4 | The `urlpatterns` list routes URLs to views. For more information please see: 5 | https://docs.djangoproject.com/en/4.2/topics/http/urls/ 6 | Examples: 7 | Function views 8 | 1. Add an import: from my_app import views 9 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 10 | Class-based views 11 | 1. Add an import: from other_app.views import Home 12 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 13 | Including another URLconf 14 | 1. Import the include() function: from django.urls import include, path 15 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 16 | """ 17 | from django.contrib import admin 18 | from django.urls import path 19 | from .views import * 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path('home/',home), 23 | path('about/',about), 24 | path('service/',service), 25 | path('',home) 26 | ] 27 | -------------------------------------------------------------------------------- /myapp/myapp/views.py: -------------------------------------------------------------------------------- 1 | from django.http import HttpResponse 2 | from django.shortcuts import render 3 | import datetime 4 | def home(request): 5 | # return HttpResponse("

This is index page

") 6 | j = request.POST['lopa'] # Retrieve the value of 'lopa' from the POST data 7 | print(j) # Print the value of 'lopa' 8 | isActive=True 9 | name="Learning django" 10 | list_of_functions= [ 11 | "WAF TO CHECK EVEN OR ODD", 12 | "WAF TO CHECK PRIME NUMBER", 13 | "WAF TO PRINT NUMBER FROM 1 TO 100", 14 | "WAF TO PRINT TRIANGLE" 15 | ] 16 | data={ 17 | 'isActive':isActive, 18 | 'name':name, 19 | 'list_of_functions':list_of_functions 20 | } 21 | return render(request,"home.html",data) 22 | 23 | def about(request): 24 | # return HttpResponse("

About Page

") 25 | return render(request,"about.html",{"Shubham":1,"Aman":2}) 26 | 27 | def service(request): 28 | # return HttpResponse("

Service Page

") 29 | return render(request,"service.html",{}) -------------------------------------------------------------------------------- /myapp/templates/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {% include 'nav.html' %} 10 |

WELCOME TO OUR WEBSITE

11 |
12 | {% csrf_token %} 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 |

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit 22 | amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, 23 | semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum 24 | diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. 25 | Pellentesque congue.

26 | 27 | 28 |

{{name}}

29 |

{{isActive}}

30 |

{{list_of_functions}}

31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Learning Django with myapp 🐍 3 | 4 | Welcome to the Learning Django project with "myapp"! This repository is my journey in learning Django, a powerful Python web framework. 🚀 5 | 6 | ![Alt Text](https://imgs.search.brave.com/vM9eQKwHOveCj0C61bw6jPmmXs3dJustYYQyiuDi1bQ/rs:fit:860:0:0/g:ce/aHR0cHM6Ly9taXJv/Lm1lZGl1bS5jb20v/djIvMSp3MWVVWFpZ/amZTdVJzdzI0V0E4/RkxBLmpwZWc) 7 | 8 | 9 | ## Project Structure 📂 10 | 11 | - **myapp**: This directory contains your Django application. Inside this directory, you'll find files related to your Django models, views, and templates. 12 | 13 | - **templates**: This directory stores HTML templates used to render web pages in your Django application. 14 | 15 | - **website**: This directory may contain additional components, apps, or configurations specific to your project's website. 16 | 17 | - **db.sqlite3**: This is the SQLite database file for your Django project. Django uses this database by default for local development. 🗃️ 18 | 19 | - **manage.py**: This is the Django management script. You use it to perform various tasks, such as running the development server, creating database tables, and more. 🛠️ 20 | 21 | ## Tools Used 🛠️ 22 | 23 | 24 | 25 | 29 | 33 | 37 | 41 | 42 | 43 |
26 | Python 27 |
django 28 |
30 | Github 31 |
Python 32 |
34 | PyCharm 35 |
PyCharm 36 |
38 | Github 39 |
Github 40 |
44 | 45 | ## Getting Started 🏁 46 | 47 | To get started with this project, follow these steps: 48 | 49 | 1. Clone this repository to your local machine: ``git clone https://github.com/Shubh2-0/Learning_django.git`` 50 | 51 | 2. Navigate to the project directory: ``cd myapp`` 52 | 53 | 3. Install the project's dependencies: ``pip install -r requirements.txt`` 54 | 55 | 4. Run the Django development server: ``python manage.py runserver`` 56 | 57 | 🌐 Access the project in your web browser at http://localhost:8000. 🌐 58 | 59 | # Usage 🚧 60 | Feel free to explore the project's code and structure to learn more about Django development. You can also contribute to this project by opening issues or submitting pull requests. 🤝 61 | 62 | # Contributing 🙌 63 | Contributions are welcome! If you have ideas for improvements or would like to report issues, please create a GitHub issue or submit a pull request following our contribution guidelines. 🎉 64 | 65 | ## 📬 Contact 66 | 67 | If you want to contact me, you can reach me through below handles. 68 | 69 |

70 | linkedin  71 | mail-me  72 | whatsapp-me  73 |

74 | 75 | 76 | -------------------------------------------------------------------------------- /myapp/myapp/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for myapp project. 3 | 4 | Generated by 'django-admin startproject' using Django 4.2.4. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/4.2/ref/settings/ 11 | """ 12 | 13 | from pathlib import Path 14 | import os 15 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 16 | BASE_DIR = Path(__file__).resolve().parent.parent 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'django-insecure-kafm_7*^8ph+56*oia*!6f6_w5wg=ysu&#n&#&f%%ydugjds_%' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'website' 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'myapp.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [os.path.join(BASE_DIR,"templates")], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'myapp.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/4.2/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': BASE_DIR / 'db.sqlite3', 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/4.2/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_TZ = True 114 | 115 | 116 | # Static files (CSS, JavaScript, Images) 117 | # https://docs.djangoproject.com/en/4.2/howto/static-files/ 118 | 119 | STATIC_URL = 'static/' 120 | 121 | # Default primary key field type 122 | # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field 123 | 124 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' 125 | --------------------------------------------------------------------------------