Investigate model object in REPL
For example you defined a model ProductPage in file models.py in app machinery, and a StreamField images:
from wagtail.core.models import Page
class ProductPage(Page):
...
images = StreamField([("images", ProductImageBlock())])
...
After create a ProductPage and upload some images through wagtail admin panel, how to get URL of each image?
./manage.py shell -i ipython
>>> from machinery.models import ProductPage
>>> pages = ProductPage.objects.all()
>>> page1 = pages[0]
>>> img1 = page1.images[0]
>>> img1.render()
'...<img src="/media/images/HTB1oDdueEGF3KVjSZFoq6zmpFXa7.jpg_350x350.min-350x350.jpg"></img>...'
Now you can extract the URL of each image.
以下为 2012-05-21 版本:
安装过程按照 Installing an official release manually 完成;
连接Django测试服务器(项目是Django官网Tutorial中的Poll项目):
-
启动服务器:manage runserver 0.0.0.0:8123
-
远程连接:http://10.31.1.71:8123/polls/