我想用python创建博客,随着链接的创建,问题出现了: [似乎没有任何模式。如果您在文件中看到有效的模式,则说明问题可能是由循环导入引起的。]
urls.py-Post
<svg id="graph" class="text-center" viewBox="245 45 365 380" display="block">
<defs>
<pattern id="image" x="0" y="0" height="100%" width="100%">
<a href="index.html">
<image width="260" height="260" xlink:href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/222579/beagle400.jpg"></image>
</a>
</pattern>
</defs>
<circle id="sd" class="medium" cx="430.75" cy="175.075" r="127.5" fill="url(#image)" stroke="black" stroke-width="5" />
<text text-anchor="middle" x="430.75" y="370" style="color:#274666; font-size:40px;">CheesyTools</text>
<text text-anchor="middle" x="430.75" y="400" style="color:#274666; font-size:20px;">The world's leading website in being useless.</text>
</svg>
urls.py-博客
from django.conf.urls import url
from django.conf.urls import include
from . import views
app_name='Post'
urlpattern = [
url(r'^$', views.all_posts, name='all_posts'),
url(r'^(?P<id>\d+)$', views.post, name='post')
]
views.py
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url('admin/', admin.site.urls),
url('blog/' , include('Post.urls', namespace='blog'))
]
models.py
from __future__ import unicode_literals
from django.shortcuts import render
# Create your views here.
from .models import Post
def all_posts(request):
all_posts = Post.objects.all()
return render(request, 'all_posts.html')
def post(request, id):
pass
我需要帮助,谢谢
答案 0 :(得分:0)
现在您可以使用 Python 和 Django 代码创建博客。如果您熟悉这些语言,则可以使用这些语言轻松创建博客。在 https://micropyramid.com/blog/how-to-create-a-simple-blog-using-python-as-well-as-django/
获取有关它的详细信息