开发
class NewsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'news'
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'news.apps.NewsConfig'
]
from news import views
urlpatterns = [
path('admin/', admin.site.urls),
path('abcd',views.index)
]
- json HttpResponse
- html render
def index(request):
context = {
'news_list': [
{
'title': "图雀写作工具推出了新的版本",
"content": "随随便便就能写出一篇好教程,真的很神奇",
},
{
"title": "图雀社区正式推出快速入门系列教程",
"content": "一杯茶的功夫,让你快速上手,绝无担忧",
},
],
'name':'lusifer',
'age':17778179517
}
print(type(context))
jd= json.dumps(context)
return render(request,'news/idx.html',json.loads(jd))
静态资源
- root
- app
- static
- js
- css
- image
- plugins
vue
,antd