0% found this document useful (0 votes)
3 views2 pages

Django HTML CSS Cheatsheet

This document is a cheatsheet covering the basics of Django, HTML, and CSS. It includes commands for creating projects and apps in Django, common HTML structure and tags, and CSS syntax and selectors. Additionally, it outlines concepts like the box model and responsive design in CSS.

Uploaded by

hermes.ar90745
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Django HTML CSS Cheatsheet

This document is a cheatsheet covering the basics of Django, HTML, and CSS. It includes commands for creating projects and apps in Django, common HTML structure and tags, and CSS syntax and selectors. Additionally, it outlines concepts like the box model and responsive design in CSS.

Uploaded by

hermes.ar90745
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Django, HTML, CSS Cheatsheet with Explanations

Django Basics
1. Create Project: django-admin startproject projectname
2. Create App: python manage.py startapp appname
3. Run Server: python manage.py runserver
4. Migrations:
- Make: python manage.py makemigrations
- Apply: python manage.py migrate
5. Admin:
- Create superuser: python manage.py createsuperuser
- Register model in admin.py
6. Views:
- Defined in views.py
- Return HttpResponse or render(template.html, context)
7. URLs:
- In project urls.py: path('app/', include('app.urls'))
- In app urls.py: path('route/', view_function, name='name')
8. Templates:
- Use {% %} for logic and {{ }} for variables
- Extend base templates using {% extends "base.html" %}

HTML Basics
1. Structure:
<!DOCTYPE html>
<html>
<head><title>Title</title></head>
<body>Content here</body>
</html>
2. Common Tags:
- <h1> to <h6>: Headings
- <p>: Paragraphs
- <a href="url">Link</a>
- <img src="img.jpg" alt="desc">
- <div>: Container
- <form>: User input
3. Attributes: class, id, href, src, alt, style, etc.

CSS Basics
1. Syntax:
selector { property: value; }
2. Types:
- Inline: <p style="color:red;">
- Internal: <style>...</style> in <head>
- External: link to .css file
3. Selectors:
- .class, #id, tag
- div p (descendant), div > p (child)
4. Box Model: margin, border, padding, content
Django, HTML, CSS Cheatsheet with Explanations

5. Layout:
- display: block, inline, flex, grid
- position: static, relative, absolute, fixed
6. Responsive:
- media queries: @media (max-width: 600px) { ... }

You might also like