[Flask] content - storing - rendering

Corey Boyle coreybrett at gmail.com
Fri Sep 4 22:39:49 CEST 2015


If you don't want to use a database, and you don't want to build an admin
portal, then storing the data directly in the code as a dictionary or list
seems like a reasonable solution. I would probably create a separate file
and import the data into the app file.

~Sent from my Nexus 5
On Sep 4, 2015 4:13 PM, "un gern" <ungern at zetteeh.net> wrote:

> hey christophe,
>
> thanks for your response.
> basically i want to do kind of a portfolio-site.
> the update frequency is maybe once per month.
> wordpress and other cms-systems - which are probably more common to use in
> this case - are no option for me.
>
> the working-example:
> the side should host pictures/video/sound related to projects that have a
> short or semi-long (text-)description. the projects itself should be
> dynamically rendered - depending on the user-request / a filter.
> also the text itself should be manipulatable: the side is multi/bi-lingual
> and each version is available in different versions ('normal' and 'easy
> language').
>
> right now i have a list of dictionaries like:
> projects: [{'name': 'skyscraper', 'date': 'may 1999', 'description': 'wow
> it's really high and looks great'}, {'name': '12 pictures', 'date': 'april
> 2008', 'description': '12 places of meaningful meaninglessness'},{..}]
>
> in the template i'm calling them like
>
> {% for project in projects %)
>         blabla {{ project.name }} in {{ project.date }} [… and so on ]
> {% endfor %}
>
>
> i thought maybe i could have a textfile and write a little
> markup-python-function that pulls content from that .txt file.
> if there will be a new project i simply add the description to the
> textfile.
>
> but there is probably a much easier/better solution and i just don't
> see/get it.
> basically this is what you do all the time with a blog, right? but i don't
> need a complete 'online' interface especially because i don't need to take
> any user input.
>
> so far.
> is it now possible to picture my sorrows?
>
> thanks for reading! ( :
> cheers
> f
>
> On Sep 4, 2015, at 3:36 PM, Christophe Bal <projetmbc at gmail.com> wrote:
>
> > Hello.
> >
> > Can you give a minimal working example ?
> >
> > Le 4 sept. 2015 11:37, "un gern" <ungern at zetteeh.net> a écrit :
> > hi there,
> >
> > somehow i got a bit confused although i thought i did get the basic
> concept of flask..?!
> > how/ from where does the content (text) get onto the screen?
> > i created a basic.html template and want to work with several
> child-templates. right now i have stored some information directly in the
> app.py file and render it on a url-request. but this seems to be the wrong
> place for the information.
> > i also thought of a little markup-funktion in the app.py file that would
> take text from an static .txt file stored on the server.
> > or does a database the best job for that - even though i don't need to
> take/store any user-input?
> >
> > is there any common workflow i missed?
> >
> > thanks!
> > florian
> >
> >
> > _______________________________________________
> > Flask mailing list
> > Flask at python.org
> > https://mail.python.org/mailman/listinfo/flask
> >
>
>
> _______________________________________________
> Flask mailing list
> Flask at python.org
> https://mail.python.org/mailman/listinfo/flask
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20150904/a32aafce/attachment.html>


More information about the Flask mailing list