feat(projects): 新增Django综合案例示例代码及素材
This commit is contained in:
0
projects/web-django/quickstart/myapp/__init__.py
Normal file
0
projects/web-django/quickstart/myapp/__init__.py
Normal file
3
projects/web-django/quickstart/myapp/admin.py
Normal file
3
projects/web-django/quickstart/myapp/admin.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
6
projects/web-django/quickstart/myapp/apps.py
Normal file
6
projects/web-django/quickstart/myapp/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class MyappConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'myapp'
|
||||
3
projects/web-django/quickstart/myapp/models.py
Normal file
3
projects/web-django/quickstart/myapp/models.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
3
projects/web-django/quickstart/myapp/tests.py
Normal file
3
projects/web-django/quickstart/myapp/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
61
projects/web-django/quickstart/myapp/views.py
Normal file
61
projects/web-django/quickstart/myapp/views.py
Normal file
@@ -0,0 +1,61 @@
|
||||
from django.http import HttpResponse
|
||||
|
||||
|
||||
def poem(request):
|
||||
|
||||
content = """
|
||||
<style>
|
||||
figure {
|
||||
display: block;
|
||||
margin: auto;
|
||||
width: 40%;
|
||||
}
|
||||
figure > figcaption {
|
||||
text-align: center;
|
||||
}
|
||||
blockquote {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
blockquote p {
|
||||
padding: 15px;
|
||||
line-height: 1cm;
|
||||
background: #eee;
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
||||
<figure>
|
||||
<blockquote>
|
||||
<i>
|
||||
<p>
|
||||
Beautiful is better than ugly.<br />
|
||||
Explicit is better than implicit.<br />
|
||||
Simple is better than complex.<br />
|
||||
Complex is better than complicated.<br />
|
||||
Flat is better than nested.<br />
|
||||
Sparse is better than dense.<br />
|
||||
Readability counts.<br />
|
||||
Special cases aren't special enough to break the rules.<br />
|
||||
Although practicality beats purity.<br />
|
||||
Errors should never pass silently.<br />
|
||||
Unless explicitly silenced.<br />
|
||||
In the face of ambiguity, refuse the temptation to guess.<br />
|
||||
There should be one-- and preferably only one --obvious way to do
|
||||
it.<br />
|
||||
Although that way may not be obvious at first unless you're
|
||||
Dutch.<br />
|
||||
Now is better than never.<br />
|
||||
Although never is often better than *right* now.<br />
|
||||
If the implementation is hard to explain, it's a bad idea.<br />
|
||||
If the implementation is easy to explain, it may be a good idea.<br />
|
||||
Namespaces are one honking great idea -- let's do more of those!<br />
|
||||
</p>
|
||||
</i>
|
||||
</blockquote>
|
||||
<figcaption>
|
||||
——Tim Peters, <cite><b>The Zen of Python</b></cite>
|
||||
</figcaption>
|
||||
</figure>
|
||||
"""
|
||||
|
||||
return HttpResponse(content)
|
||||
Reference in New Issue
Block a user