Skip to content

Commit 11d4c9f

Browse files
committed
Code snippets
1 parent 16bd511 commit 11d4c9f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1224
-0
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Mac
2+
.DS_Store
3+
4+
# Byte-compiled / optimized / DLL files
5+
__pycache__/
6+
*.py[cod]
7+
*$py.class
8+
9+
# C extensions
10+
*.so
11+
12+
# Distribution / packaging
13+
.Python
14+
build/
15+
develop-eggs/
16+
dist/
17+
downloads/
18+
eggs/
19+
.eggs/
20+
lib/
21+
lib64/
22+
parts/
23+
sdist/
24+
var/
25+
wheels/
26+
pip-wheel-metadata/
27+
share/python-wheels/
28+
*.egg-info/
29+
.installed.cfg
30+
*.egg
31+
MANIFEST
32+
33+
# PyInstaller
34+
# Usually these files are written by a python script from a template
35+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
36+
*.manifest
37+
*.spec
38+
39+
# Installer logs
40+
pip-log.txt
41+
pip-delete-this-directory.txt
42+
43+
# Unit test / coverage reports
44+
htmlcov/
45+
.tox/
46+
.nox/
47+
.coverage
48+
.coverage.*
49+
.cache
50+
nosetests.xml
51+
coverage.xml
52+
*.cover
53+
.hypothesis/
54+
.pytest_cache/
55+
56+
# Translations
57+
*.mo
58+
*.pot
59+
60+
# Django stuff:
61+
*.log
62+
local_settings.py
63+
db.sqlite3
64+
65+
# Flask stuff:
66+
instance/
67+
.webassets-cache
68+
69+
# Scrapy stuff:
70+
.scrapy
71+
72+
# Sphinx documentation
73+
docs/_build/
74+
75+
# PyBuilder
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
.python-version
87+
88+
# celery beat schedule file
89+
celerybeat-schedule
90+
91+
# SageMath parsed files
92+
*.sage.py
93+
94+
# Environments
95+
.env
96+
.venv
97+
env/
98+
venv/
99+
ENV/
100+
env.bak/
101+
venv.bak/
102+
103+
# Spyder project settings
104+
.spyderproject
105+
.spyproject
106+
107+
# Rope project settings
108+
.ropeproject
109+
110+
# mkdocs documentation
111+
/site
112+
113+
# mypy
114+
.mypy_cache/
115+
.dmypy.json
116+
dmypy.json
117+
118+
# Pyre type checker
119+
.pyre/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: gunicorn django_project.wsgi

Django_Blog/13-Deployment-Heroku/django_project/blog/__init__.py

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from django.contrib import admin
2+
from .models import Post
3+
4+
admin.site.register(Post)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class BlogConfig(AppConfig):
5+
name = 'blog'
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Generated by Django 2.1 on 2018-08-28 02:32
2+
3+
from django.conf import settings
4+
from django.db import migrations, models
5+
import django.db.models.deletion
6+
import django.utils.timezone
7+
8+
9+
class Migration(migrations.Migration):
10+
11+
initial = True
12+
13+
dependencies = [
14+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
15+
]
16+
17+
operations = [
18+
migrations.CreateModel(
19+
name='Post',
20+
fields=[
21+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
22+
('title', models.CharField(max_length=100)),
23+
('content', models.TextField()),
24+
('date_posted', models.DateTimeField(default=django.utils.timezone.now)),
25+
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
26+
],
27+
),
28+
]

Django_Blog/13-Deployment-Heroku/django_project/blog/migrations/__init__.py

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from django.db import models
2+
from django.utils import timezone
3+
from django.contrib.auth.models import User
4+
from django.urls import reverse
5+
6+
7+
class Post(models.Model):
8+
title = models.CharField(max_length=100)
9+
content = models.TextField()
10+
date_posted = models.DateTimeField(default=timezone.now)
11+
author = models.ForeignKey(User, on_delete=models.CASCADE)
12+
13+
def __str__(self):
14+
return self.title
15+
16+
def get_absolute_url(self):
17+
return reverse('post-detail', kwargs={'pk': self.pk})
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
body {
2+
background: #fafafa;
3+
color: #333333;
4+
margin-top: 5rem;
5+
}
6+
7+
h1, h2, h3, h4, h5, h6 {
8+
color: #444444;
9+
}
10+
11+
ul {
12+
margin: 0;
13+
}
14+
15+
.bg-steel {
16+
background-color: #5f788a;
17+
}
18+
19+
.site-header .navbar-nav .nav-link {
20+
color: #cbd5db;
21+
}
22+
23+
.site-header .navbar-nav .nav-link:hover {
24+
color: #ffffff;
25+
}
26+
27+
.site-header .navbar-nav .nav-link.active {
28+
font-weight: 500;
29+
}
30+
31+
.content-section {
32+
background: #ffffff;
33+
padding: 10px 20px;
34+
border: 1px solid #dddddd;
35+
border-radius: 3px;
36+
margin-bottom: 20px;
37+
}
38+
39+
.article-title {
40+
color: #444444;
41+
}
42+
43+
a.article-title:hover {
44+
color: #428bca;
45+
text-decoration: none;
46+
}
47+
48+
.article-content {
49+
white-space: pre-line;
50+
}
51+
52+
.article-img {
53+
height: 65px;
54+
width: 65px;
55+
margin-right: 16px;
56+
}
57+
58+
.article-metadata {
59+
padding-bottom: 1px;
60+
margin-bottom: 4px;
61+
border-bottom: 1px solid #e3e3e3
62+
}
63+
64+
.article-metadata a:hover {
65+
color: #333;
66+
text-decoration: none;
67+
}
68+
69+
.article-svg {
70+
width: 25px;
71+
height: 25px;
72+
vertical-align: middle;
73+
}
74+
75+
.account-img {
76+
height: 125px;
77+
width: 125px;
78+
margin-right: 20px;
79+
margin-bottom: 16px;
80+
}
81+
82+
.account-heading {
83+
font-size: 2.5rem;
84+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{% extends "blog/base.html" %}
2+
{% block content %}
3+
<h1>About Page</h1>
4+
{% endblock content %}

0 commit comments

Comments
 (0)