Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
TheOtherContraGuy
Jul 4, 2007

brave skeleton sacrifice
This mostly a general design question.

I'm trying to clean up some code about 100 lines of it is just me defining some parameters for several different webpages I make. Is it kosher for me to just pickle these presets?

Adbot
ADBOT LOVES YOU

TheOtherContraGuy
Jul 4, 2007

brave skeleton sacrifice

QuarkJets posted:

What's the purpose of pickling them? You're still going to have to have lines of code that define those parameters , more lines that pickle those parameters , and then you'll have to add lines of code to unpickle them. That's way messier than just putting your parameters into a separate .py and importing from it the specific parameters that you need

Good point. I'll do that.

TheOtherContraGuy
Jul 4, 2007

brave skeleton sacrifice
I have a project at work that generates a static HTML document from a plaintext input that is used as a weekly email. Right now the code is pretty messy and I have time to clean it up. I would also like to learn Django or Flask. Do you guys have a suggestion for a module that handles templated HTML generation?

TheOtherContraGuy
Jul 4, 2007

brave skeleton sacrifice

good jovi posted:

If you're using Django, its builtin templating engine is totally fine. Otherwise, jinja is a good way to go.

Great, thanks!

TheOtherContraGuy
Jul 4, 2007

brave skeleton sacrifice
I'm in charge of a very exciting project at work that involves filtering results of an API and standardizing/storing the information in a database so that we can do in depth analysis on the data set. I'm pretty confident in my ability to write Python but this is the first time I've built my own database. Should I be using SQLAlchemy as an ORM? This book was published in 2008, would it still be relevant to me? http://shop.oreilly.com/product/9780596516147.do

TheOtherContraGuy
Jul 4, 2007

brave skeleton sacrifice

KICK BAMA KICK posted:

SQLAlchemy just went 1.0 like a week ago and that book was written for 0.5 I think. I'm sure a lot of it still works but I bet the gritty details you'd hope to learn from a textbook are precisely the things that are now out of date. Haven't read it myself though for that reason.

I found SQLAlchemy easy enough to pick up more or less at the same time I've been learning Python from scratch -- didn't know the first thing about databases either -- so maybe just give it a shot and ask questions here. My tips would be stick with what they call the declarative syntax for defining your models if possible, keep all those definitions in the same package, and really take a minute to understand the concept of the Session before you start designing the guts of the application.

This is a good article; not an actual tutorial but it points out some common mistakes.

Thanks!

Adbot
ADBOT LOVES YOU

TheOtherContraGuy
Jul 4, 2007

brave skeleton sacrifice
Hey, I'm building a database application for my team inside a larger company. The purpose of this application is to collect some XML data from a website then have a user add extra tags/QC before pushing this data to the central SalesForce database. I think I'm going to use SQLAlchemy with a SQLite3 database. I still haven't decided on a frontend, though. I have more knowledge of WebDev then GUI, so I was thinking of making a Google Chrome App. Does this make sense? Are there other alternatives I should consider?

  • Locked thread