Exemplo n.º 1
0
def dev_site():
    """
    Deploys a "hello world" demo site with default settings
    """
    init_db()
    meta = Meta()
    # fix up a default user
    username = u'admin'
    password = u'password'
    hash = hash_it(username, password)
    email = u'*****@*****.**'
    user = User(username=u'admin', hashedpassword=hash, email=email)
    user.first_name = u'Joe'
    user.last_name = u'Schmoe'
    user.save()

    # fix up a hello post
    content = u"""
**This** is an example post for the wonderful site of %s.  
This is a simple dev-post. Ready to be deleted at your leisure.  
[This](http://example.com/#) is a link.  
""" % (meta.domain)
    html_content = markdown(content, extensions)
    title = u"Hello, World!"
    post = Post(title=title,content=content, html_content=html_content, author=user)
    post.slugid = slugidfy()
    post.slug = slugfy(title)
    post.published = datetime.datetime.now()
    post.created = datetime.datetime.now()
    post.is_published = True
    post.save()