Skip to content

appsDone #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
16 changes: 16 additions & 0 deletions MohammedApp/MohammedApp/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for MohammedApp 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/5.1/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'MohammedApp.settings')

application = get_asgi_application()
124 changes: 124 additions & 0 deletions MohammedApp/MohammedApp/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
"""
Django settings for MohammedApp project.

Generated by 'django-admin startproject' using Django 5.1.2.

For more information on this file, see
https://docs.djangoproject.com/en/5.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.1/ref/settings/
"""

from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure--u8fk)nql7$d-rh&4=cd=!++j7ar$(*3x2)(5-3q9mq*mu-ak2'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'main',
]

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 = 'MohammedApp.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 = 'MohammedApp.wsgi.application'


# Database
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}


# Password validation
# https://docs.djangoproject.com/en/5.1/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/5.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.1/howto/static-files/

STATIC_URL = 'static/'

# Default primary key field type
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
27 changes: 27 additions & 0 deletions MohammedApp/MohammedApp/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
URL configuration for MohammedApp project.

The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/5.1/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 path
from main import views
urlpatterns = [
path('admin/', admin.site.urls),
path('', views.home, name='home'),
path('about/', views.about, name='about'),
path('projects/', views.projects, name='projects'),
path('contact/', views.contact, name='contact'),
path('cv/', views.cv, name='cv'),
]
16 changes: 16 additions & 0 deletions MohammedApp/MohammedApp/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for MohammedApp 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/5.1/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'MohammedApp.settings')

application = get_wsgi_application()
Empty file added MohammedApp/main/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions MohammedApp/main/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions MohammedApp/main/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class MainConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'main'
Empty file.
3 changes: 3 additions & 0 deletions MohammedApp/main/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions MohammedApp/main/static/main/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex; /* Use Flexbox for body */
flex-direction: column; /* Stack children vertically */
height: 100vh; /* Full height of the viewport */
background-color: #f5f5f5; /* Background color */
}

main {
display: flex; /* Use Flexbox for main */
justify-content: center; /* Center content horizontally */
align-items: center; /* Center content vertically */
flex-grow: 1; /* Take up remaining space */
padding: 20px; /* Add padding */
text-align: center; /* Center text */
}

.content-container {
max-width: 800px; /* Limit width for better readability */
width: 100%; /* Responsive width */
}

h1, h2 {
margin: 20px 0; /* Space above and below headings */
}

ul {
list-style-position: inside; /* Bullets inside list */
padding: 0; /* Remove default padding */
}

footer {
text-align: center;
padding: 10px;
background-color: #333;
color: white;
}
24 changes: 24 additions & 0 deletions MohammedApp/main/templates/main/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{% extends 'main/base.html' %}
{% load static %}
{% block title %}About{% endblock %}
{% block content %}
<div class="content-container">
<h1>About Me</h1>
<p>Hello! I'm Mohammed, a passionate computer engineer with a keen interest in technology and innovation.</p>
<p>
This website showcases my work, projects, and experiences in the field of engineering and programming.
Here’s a brief overview of what you can find:
</p>
<ul>
<li><strong>Home:</strong> A welcoming introduction to my website.</li>
<li><strong>About:</strong> Information about my background and interests.</li>
<li><strong>Projects:</strong> Details of my graduation project—a firefighting robot—along with descriptions of my skills and experiences.</li>
<li><strong>Contact:</strong> A way to get in touch with me for inquiries or collaborations.</li>
<li><strong>CV:</strong> My resume highlighting my education, skills, and professional experiences.</li>
</ul>
<p>
I hope this website provides insight into my journey as an engineer and inspires others
in the tech community. Feel free to explore!
</p>
</div>
{% endblock %}
29 changes: 29 additions & 0 deletions MohammedApp/main/templates/main/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% load static %}
<link rel="stylesheet" href="{% static 'main/styles.css' %}">
<title>{% block title %}My Projects{% endblock %}</title>
</head>
<body>
<header>
<nav>
<ul>
<li><a href="{% url 'home' %}">Home</a></li>
<li><a href="{% url 'about' %}">About</a></li>
<li><a href="{% url 'projects' %}">Projects</a></li>
<li><a href="{% url 'contact' %}">Contact</a></li>
<li><a href="{% url 'cv' %}">CV</a></li>
</ul>
</nav>
</header>
<main>
{% block content %}{% endblock %}
</main>
<footer>
<p>&copy; 2024 By Mohammed</p>
</footer>
</body>
</html>
17 changes: 17 additions & 0 deletions MohammedApp/main/templates/main/contact.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends 'main/base.html' %}
{% block title %}Contact{% endblock %}
{% block content %}
<div class="content-container">
<h1>Contact Me</h1>
<form method="post">
{% csrf_token %}
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="message">Message:</label>
<textarea id="message" name="message" required></textarea>
<button type="submit">Send</button>
</form>
</div>
{% endblock %}
25 changes: 25 additions & 0 deletions MohammedApp/main/templates/main/cv.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{% extends 'main/base.html' %}
{% block title %}CV{% endblock %}
{% block content %}
<h1>CV</h1>

<h2>Personal Information</h2>
<p><strong>Name:</strong> Mohammed Alkathiri</p>
<p><strong>Email:</strong> [email protected]</p>
<p><strong>Phone:</strong> +966553011972</p>

<h2>Education</h2>
<ul>
<li><strong>Degree</strong>, Computer Engineer ,bachelor Degree ,2024</li>

</ul>

<h2>Skills</h2>
<ul>
<li>Programming</li>
<li>Cyber security</li>
</ul>

<h2>Contact</h2>
<p>If you would like to get in touch, please visit the <a href="{% url 'contact' %}">Contact</a> page.</p>
{% endblock %}
8 changes: 8 additions & 0 deletions MohammedApp/main/templates/main/home.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends 'main/base.html' %}
{% block title %}Home{% endblock %}
{% block content %}
<div class="content-container">
<h1>Welcome to My Website</h1>
<p>This website showcases my projects, skills, and experiences in the field of engineering and programming. Whether you're interested in my graduation project or want to know more about my background, you've come to the right place!</p>
</div>
{% endblock %}
17 changes: 17 additions & 0 deletions MohammedApp/main/templates/main/projects.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends 'main/base.html' %}
{% load static %}
{% block title %}Projects{% endblock %}
{% block content %}
<div class="content-container">
<h1>My Graduation Project</h1>
<section>
<h2>Fire Fighting Robot</h2>
<img src="{% static 'main/images/fire_fighting_robot.jpg' %}" alt="Fire Fighting Robot" style="max-width: 100%; height: auto;">
<p>
My graduation project is a Fire Fighting Robot designed to autonomously detect and extinguish fires.
This robot utilizes advanced sensors and a water spray mechanism to effectively combat small fires
in indoor environments, enhancing safety and emergency response capabilities.
</p>
</section>
</div>
{% endblock %}
3 changes: 3 additions & 0 deletions MohammedApp/main/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
22 changes: 22 additions & 0 deletions MohammedApp/main/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from django.shortcuts import render

# Create your views here.
from django.shortcuts import render

def home(request):
return render(request, 'main/home.html')

def about(request):
return render(request, 'main/about.html')

def projects(request): # Updated function name
return render(request, 'main/projects.html') # Updated template name

def contact(request):
if request.method == 'POST':
# Handle the form submission here
print(request.POST)
return render(request, 'main/contact.html')

def cv(request):
return render(request, 'main/cv.html')
Loading