Python Forum

Full Version: Have a specific app need but new to Python and Have some questions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey all. I am new to Python for the most part. I do have OpenHAB running some home automation at my house that uses a few, somewhat simple, python scripts. I am mostly a hobbiest but do create apps and scripts in my job as an IT Operations Lead, so know my way around. I have heard great things about Python and don't really know a language really well as I never settled, but think I want to finally really learn a language well so here I am. My biggest issue is not so much the logic; rather it is just the syntax and best practices, etc.

So, I have a specific project I want to wok on which is rebuilding a very old web application that I use at work that someone else created long ago using perl and cgi. It works OK, but basically has 0 scale in anyway. From a high level view, it is actually very simple in what it is doing - it is essentially a syslog query. We are running Kiwi Syslog on one of the networks I manage, which works great. It creates a new text file, one a day, with all the various messages in them. The files are fairly small on this particular network as it runs the machine automation and robotics so the footprint is small compared to our business network.

The way the current app works is that is pushes all of the text files into an array (I think there is some hashing going on as well, but only for a few things). Then the web component displays some summary information (top loggers, which is determined by functions run on the data structure), then options to drill down to specific switches and other nodes. Options to filter on date, message types, etc and then display this on a different page. The filtering is done via PERL and regex essentially based on a few form inputs, so as I said it is quite simple.

I do have the capability to store the syslog messages in a database (basically a single table) in addition to txt files and I am thinking about doing that to make it even easier, though I need to be sure to figure out a way to keep the data in the DB to only a year.

I want to use Django for this, so does anyone have any recommendations on some methods to create this type of app. I don't need specifics, but am in the beginning phase of not even sure where to start or what I should be working towards in terms of programming, so any suggestions will be helpful!

Thanks!

Mike
You can start by sifting through these applications, and if you find one that comes close to what you want to do,
download the source code to get an idea of what you need to do: https://pypi.python.org/pypi?%3Aaction=s...mit=search
I do very little web work, but I hear great things about Flask (which is a python package).
See, this is the kind of answer I needed. You don't know what you don't know, right? I had no idea this existed and it should be helpful with some things. I appreciate the link.

Yeah, without any real comparison, I chose Django over Flask, but have no real reason why :) Actually, though, since you mentioned it, and someone else did today also, I went back and read more about it. Sounds like both have their pros and cons, but since I am not going to be doing A LOT of development and do like a little more control, it looks like Flask may actually be better. Thanks again for the response!