On May 21, 2008, at 11:07 PM, sebey wrote:
>
>
>> Use Feedparser (http://www.feedparser.org/) in a stand-alone script,
>> run by a cron job, that checks feeds for updates a few times per day.
>> Have a django model that represents rss feeds and feed items, and
>> then
>> import the necessary stuff at the top of your feed parser script so
>> that you can save new feed items to the database as they come in.
>> Once
>> the feed items are in your database, you can use them as normal in
>> the
>> rest of your django app.
> I am new to web development how would I go about all of this?
To get a standalone script to run under your proper django
environment, put this at the top:
from django.core.management import setup_environ
import sys
sys.path.append('/path/to/your/project')
from yourproject import settings
setup_environ(settings)
Then you'll be able to import your feed models, create new instances,
and save them, all within this script.
Next, Google for how to set up a cron job, read the feedparser
documentation for how to use feedparser, and you're good to go!
E
>
> On May 21, 12:12 pm, Eric Abrahamsen <[EMAIL PROTECTED]> wrote:
>> On May 21, 2008, at 6:58 PM, sebey wrote:
>>
>>
>>
>>> I know css does not not have any variables but I was thinking that
>>> python/django could look though the css file and have
>>> background-color:{{insert python varible here}}
>>
>>> but I did consider that first about copy and pasting a style sheet
>>> and
>>> just change the background but I never thought about inheritance so
>>> thank you
>>
>> Why don't you just use an inline <style> section in the your
>> template's head section, and set the CSS there?
>>
>>
>>
>>> but please doe anyone no about import rss feeds form other sites and
>>> grabing about the feed them manipulate the tags to mark them up and
>>> css them
>>
>> Use Feedparser (http://www.feedparser.org/) in a stand-alone script,
>> run by a cron job, that checks feeds for updates a few times per day.
>> Have a django model that represents rss feeds and feed items, and
>> then
>> import the necessary stuff at the top of your feed parser script so
>> that you can save new feed items to the database as they come in.
>> Once
>> the feed items are in your database, you can use them as normal in
>> the
>> rest of your django app.
>>
>> Yrs,
>> Eric
>>
>>
>>
>>> On May 21, 1:33 am, Simon Tite <[EMAIL PROTECTED]> wrote:
>>>> I'm afraid I don't quite understand all of your question, but I can
>>>> possibly answer part of it, although please bear in mind I'm quite
>>>> new
>>>> at Django, so there may be better ways of doing it.
>>
>>>> On May 19, 11:50 am, sebey <[EMAIL PROTECTED]> wrote:
>>
>>>>> I am thinking about making a template that has the sturcture and
>>>>> and
>>>>> have a css template with the background color as a variable is
>>>>> this
>>>>> possible basically all the shows come form this template and css
>>>>> file
>>
>>>> As far as I know, CSS files can't have variables or constants
>>>> defined
>>>> within them. To have different colour backgrounds, my first
>>>> approach
>>>> would be simply to have different CSS files, e.g. base_red.css,
>>>> base_green.css, etc. This is an approach I am currently using in a
>>>> development I am doing, however, the drawback is obviously going to
>>>> be
>>>> the ongoing maintenance of two or more CSS files which need to be
>>>> identical apart from one or two lines defining the colour. Probably
>>>> not a tremendous problem if it is ONLY the background colour which
>>>> needs to change... The applicable CSS file to be used can be
>>>> defined
>>>> using the template system: in my base.html (which defines to
>>>> overall
>>>> structure of all subordinate pages) I have the following line:
>>
>>>> (in the <head>.....</head> block): <link rel="stylesheet"
>>>> href="../
>>>> stylesheets/{{style}}.css" type="text/css">
>>
>>>> The variable {{ style }} can be defined in the URL, or maybe in the
>>>> GET data (eg www.<somesite>.com/?style=red), or anywhere you like.
>>
>>>> This worked fine for me, because I am using it to define more than
>>>> just the background colour, but also to radically change the layout
>>>> of
>>>> the page, such as fonts, borders, graphics, element positioning
>>>> etc.
>>
>>>> However the next stage might be, to have more than one stylesheet
>>>> for
>>>> the page... I think this would work fine for just background colour
>>>> changes, for example:
>>
>>>> Style sheet red.css:
>>>> body {background-color: #FF0000;}
>>
>>>> Style sheet green.css:
>>>> body {background-color: #00FF00;}
>>
>>>> Style sheet base.css:
>>>> All the other stuff!
>>
>>>> base.html:
>>>> <head>
>>>> <link rel="stylesheet" href="../stylesheets/{{style}}.css"
>>>> type="text/css">
>>>> <link rel="stylesheet" href="../stylesheets/base.css"
>>>> type="text/
>>>> css">
>>>> </head>
>>
>>>> I haven't tried this yet, but I think it would work.
>>
>>>> The third thought to occur to me was to use JavaScript (or
>>>> something)
>>>> to directly modify the DOM model, however at this stage the
>>>> learning
>>>> curve seem too scary to me, however it might actually be the best
>>>> way
>>>> in the end, if the variations in styles become too complex.
>>
>>>>> not to mention can you load a template with in a template like
>>>>> have
>>>>> the homepages with templates inside them?
>>
>>>> Well, yes I think so... I'm not sure why you think that would not
>>>> be
>>>> possible, have you had a problem with it, or am I misunderstanding
>>>> your question?
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---