|
SlightlyMadman posted:For some reason I've never managed to get a micro server to qualify for the free tier Maybe because of this: quote:* These free tiers are only available to new AWS customers, and are available for 12 months following your AWS sign-up date.
|
# ? May 18, 2012 00:43 |
|
|
# ? Jun 8, 2024 11:27 |
Just popping in to say thanks to everyone who helped me out in this thread. Finishing up my app this weekend. Will probably push it to EC2 for my friends to play. Screenshot:
|
|
# ? May 18, 2012 05:50 |
|
fuf posted:I just asked a pretty similar question in the hosting thread. I'm looking for some cheap shared hosting that has django support. I use django on webfaction and it's pretty great. Easy setup, tutorials, support forum, etc.
|
# ? May 18, 2012 06:24 |
|
Don't bother with the aws micro if you think you'll be using more that a little cpu. They throttle that poo poo like crazy.
|
# ? May 18, 2012 10:26 |
|
Mulozon Empuri posted:Don't bother with the aws micro if you think you'll be using more that a little cpu. They throttle that poo poo like crazy. And whatever the gently caress you do, don't try to run windows on it. I don't even know why they let you, but it's completely unusable.
|
# ? May 18, 2012 17:00 |
|
Jo posted:Just popping in to say thanks to everyone who helped me out in this thread. Finishing up my app this weekend. Will probably push it to EC2 for my friends to play. Thanks to Twitter Bootstrap, most of my web apps look like this too I mostly build internal facing stuff for the university where I work though so nobody minds.
|
# ? May 18, 2012 17:23 |
|
Doesn't Heroku have a free tier as well? I'm a huge Webfaction fan (mostly for the nice SSH access) but if you just want a quick deployment..
|
# ? May 18, 2012 17:24 |
Lamacq posted:Thanks to Twitter Bootstrap, most of my web apps look like this too It's not visible in the picture, but the appropriate shout out is given at the bottom of the page. "| Layout and design are taken from Bootstrap by Twitter" I only just discovered it and totally love it. Mostly because I don't like design very much.
|
|
# ? May 18, 2012 19:48 |
|
i'm deploying a django site to heroku, and i'm trying to get static files working properly both locally, using `foreman start`, and remotely. oddly enough, my procfile:pre:web: python manage.py collectstatic --noinput; python manage.py run_gunicorn -b "0.0.0.0:$PORT" -w 3 pre:manage.py: error: no such option: --noinput; pre:manage.py: error: no such option: -b e: it seems like foreman will basically choke on any procfile i give it now, and all the errors always seem to have punctuation, like it's trying to use `5000"` for a port number. did i gently caress something up to make foreman behave so oddly? Zizzyx fucked around with this message at 05:22 on May 19, 2012 |
# ? May 19, 2012 04:43 |
I'm still in the 'learn python before using django' phase so feel free to ignore me if I'm making no sense. I'm having a small problem with the concept of a django app. How do you define what's an app? If I want to make a site that displays movies from a database and that allows user registration (or login via social network), marking what movies I've already seen, queuing movies, etc. Should each of those features be a different app inside the project? Or just one big app that manages everything?
|
|
# ? May 21, 2012 19:44 |
|
gmq posted:I'm still in the 'learn python before using django' phase so feel free to ignore me if I'm making no sense. Apps: 1. Users (already provided by django, or social users via django-social-auth) 2. Profiles (something you'll create with a 1-to-1 to users, or check out django-profiles) 3. Movies (again, all you.) You'll probably want some other app-ish things, like ratings and comments and friends/followers, all of which have contributed or third-party providers. Check out djangopackages.com for good comparisons and such.
|
# ? May 21, 2012 20:34 |
|
gmq posted:I'm still in the 'learn python before using django' phase so feel free to ignore me if I'm making no sense. In my opinion, this is the number one thing people gently caress up the most when starting a new django project. An 'app' is basically a collection of models, views, templates, management commands, that relate to one another. Don't fall into the trap of putting all your models into one 'core' app, all your templates into a 'templates' app, your views into another 'api' app, etc. Please don't do that... Please... A good rule of thumb is that an app should have at least one model, one view, and one template. If you're missing any of these parts, its a good sign that you need to rethink some things. And there shouldn't be too many imports across apps. Not a hard-and-fast rule, but useful as a guide.
|
# ? May 21, 2012 21:20 |
|
You should use django-registration, if you want a user system. Django doesn't really have a e-mail activation system by default, which is absurd, so this is basically the unofficial official user registration back-end. It doesn't come with default templates, which is a pain, but others have created projects with these. However, d-r was recently updated to a new version, and I'm not sure if these templates would be compatible with them.
|
# ? May 21, 2012 23:32 |
|
gmq posted:I'm still in the 'learn python before using django' phase so feel free to ignore me if I'm making no sense. You should try to compartmentalise functionality, which will become evident as you build your project. For example in support my main application, there is: accounts Handles company accounts, user permissions, registration and the like. Actions A small framework for actions, at the moment this is for do / undo actions (rather than views directly altering and saving models). I just subclass this throughout my application, if I want to add support for queuing actions down the track, I can do it here. History Handles a generic related model which handles logging for Actions. The two work together a bit, but don't rely on each other. Facilities Houses a model which will be shared across main applications ( if my first becomes business viable ). Basically, each company account has a one or more facilities, and the application works through those facilities. And then the main application builds on all of these. I could probably compartmentalise the main application more, but for the moment I've just got it consolidated. Basically the way to think of an application is as something other apps can use without having to be tightly coupled to it (meaning change one, change both). It might just be using information from the apps models, or including a set of urls and views from an application. It's also a good way to avoid duplication, if you build something that will likely be reusable on its own, for example something obvious like a small Content management system, split it off into its own application. Sorry, this got a bit rambling, the concept of app is a bit general, something that other stuff can make use of. First time around, I wouldn't worry too much about perfection. My first pass at this application was certainly not well designed or thought out, but I learned enough that the rewrite is going quite well.
|
# ? May 22, 2012 00:32 |
|
Zizzyx posted:works perfectly when i `git push heroku master` and load the site, but for some reason when i run `foreman start`, i get this error: This makes it sound like an issue with foreman, I'd open an issue at https://github.com/ddollar/foreman/issues. You might also try wrapping each command in params, but I'm mostly guessing here. Zizzyx posted:e: it seems like foreman will basically choke on any procfile i give it now, and all the errors always seem to have punctuation, like it's trying to use `5000"` for a port number. did i gently caress something up to make foreman behave so oddly? 5000 is the $PORT foreman will use locally by default code:
Captain Capacitor posted:Doesn't Heroku have a free tier as well? We do.
|
# ? May 22, 2012 04:12 |
|
Does anyone have links complete projects on github or something where I can see a full site / app put together? Sorta similar to the "what's an app" question, I'm struggling a bit to understand fully a good structure for a site.
|
# ? May 22, 2012 04:20 |
|
etcetera08 posted:Does anyone have links complete projects on github or something where I can see a full site / app put together? Sorta similar to the "what's an app" question, I'm struggling a bit to understand fully a good structure for a site. https://github.com/priestc/flightloggin2
|
# ? May 22, 2012 04:24 |
|
Pardot posted:5000 is the $PORT foreman will use locally by default that much i understand, but what it's trying to do is call it with the quote appended- 5000". the parsing is hosed up in some way
|
# ? May 25, 2012 10:42 |
|
Zizzyx posted:that much i understand, but what it's trying to do is call it with the quote appended- 5000". the parsing is hosed up in some way Remove the quotes. code:
etcetera08 posted:Does anyone have links complete projects on github or something where I can see a full site / app put together? Sorta similar to the "what's an app" question, I'm struggling a bit to understand fully a good structure for a site. I just made http://goonsay.shiturl.com/ the other day and its about as simple as you can get. It's a one app site and the source can be found here: https://github.com/Ell/Goonsay Its running currently on herokus free tier with no hiccups that I can see so far
|
# ? May 26, 2012 18:06 |
|
For my first django project, I'm building a legislator lookup script. It'll allow people to type in their zip/a name of a legislator, and see what they have said about certain issues. The way I've planned it out is having these classes: Issues IssueEntries(with foreign key to Issues, and a foreign key to Politician) Politician (abstract) -Senator -Rep -etc However, I've run in to the problem that django doesn't allow abstract classes to be called via foreignkey. What would be the best way to go about what I'm trying to do?
|
# ? May 28, 2012 20:22 |
|
Don't use subclasses like that. Have a politician table, with a "kind" column, which has valid choices "rep", "senator", etc.
|
# ? May 28, 2012 21:54 |
|
Yeah, the purpose of an abstract class is to share functionality, but the resulting tables from the children have no relationship to one another through that abstract class if I'm not mistaken.
|
# ? May 28, 2012 23:39 |
This is probably a very basic question, but I'm struggling to find similar examples and have little experience with relational databases. I'm hoping to create an application that analyzes projects based on yearly or monthly cash flows and expenses. Each project will have many cash flows (e.g., sales, royalties, partnerships) and expenses (manufacturing, sales, marketing) over a common set of periods (2010-2030). I'm stuck on the most efficient way to store the yearly data values. I'm ultimately looking to use numpy/scipy extensively for stats & simulation. Would the following work as an example of a very basic implementation? code:
code:
KingNastidon fucked around with this message at 07:03 on May 29, 2012 |
|
# ? May 29, 2012 06:30 |
|
Maluco Marinero posted:Yeah, the purpose of an abstract class is to share functionality, but the resulting tables from the children have no relationship to one another through that abstract class if I'm not mistaken. Suspicious Dish posted:Don't use subclasses like that. Have a politician table, with a "kind" column, which has valid choices "rep", "senator", etc. I had originally done it this way, but the individual subPolitician classes have different fields (rep has district, senator has state, justice has circuit and district, lobbyist has company, etc). If I do it this way, is there a way of having django sort of subcategorize within the class? For instance, could I code it so that, if I chose 'Justice' from politician_type, the Django admin would only show relevant entry fields (and give hidden null values to the rest)? I want to make this stupid-proof, since I'm not the only one going to be inputting and editing data. Also, related question: I plan on having 'scores' per issue per politician. IssueEntries will modify the scores that Politicians get per Issue. Should I have a running total_current_score per IssueEntry, or should I just do a call of sum(IssueEntry(Issue, Politician)) every time I want that score (often)? Apologies for the low-level questions, I'm just learning how to use this/python.
|
# ? May 29, 2012 12:57 |
|
What you can do in that case is use standard inheritance rather than abstract. This means ditch the 'abstract = True' option in your Politician class. That will do the following:code:
Python code:
Maluco Marinero fucked around with this message at 13:47 on May 29, 2012 |
# ? May 29, 2012 13:43 |
|
Maluco Marinero posted:What you can do in that case is use standard inheritance rather than abstract. This means ditch the 'abstract = True' option in your Politician class. That will do the following: I like this approach -- allows me to have a full list of politicians without having to call each individual subPolit. I should probably sit down and think about all the data that I need for each, see if I can make it all one class with generic fieldnames. That's what I did initially, and I still have the code for POLITICIAN_TYPES and the like, so all I gotta do is uncomment. Thank you.
|
# ? May 29, 2012 14:30 |
|
The guy in the django by example tutorials (http://lightbird.net/dbe/index.html) puts all his admin registration stuff straight inside models.py, whereas the official documentation says put it in admin.py. What's the difference? Does it matter? I had an error: code:
(To be honest the tutorials aren't really that clear, but funnily enough I'm learning a lot more as I try and work out what the hell he is doing.) fuf fucked around with this message at 15:58 on May 29, 2012 |
# ? May 29, 2012 15:49 |
|
admin.autodiscover() looks in the file admin.py for each application and does its thing with whatever belongs in there, so do that and not whatever this guy is doing. The code is getting passed over twice or repeated if it gets that error, and I'm pretty sure models does get passed over more than once due to the code that makes lazy relationships like this work.Python code:
|
# ? May 29, 2012 16:27 |
|
KingNastidon posted:This is probably a very basic question, but I'm struggling to find similar examples and have little experience with relational databases. What kind of computations are you looking to do and how much data are you planning on storing? I don't think you've given enough information about your problem to assess if your schema is good or not. That said, I'm not sure why you would make period or data a separate model. It seems to me that you should have two models, project and flow.
|
# ? May 29, 2012 16:33 |
Sharktopus posted:What kind of computations are you looking to do and how much data are you planning on storing? I don't think you've given enough information about your problem to assess if your schema is good or not. I'm hoping to store hundreds/thousands of projects with 25-50 cash flows each with daily/monthly/yearly time series data over a 20-30 year horizon. I'm hoping to run monte carlo simulations and decision & portfolio analysis. I feel very comfortable with the math & stats once I get the data in arrays, but am struggling with the basics of mapping out the data models. Is this how you're thinking I should consolidate the Flow, Data, and Period models? code:
KingNastidon fucked around with this message at 17:25 on May 29, 2012 |
|
# ? May 29, 2012 17:22 |
|
sorry, I'm not clear on where the distributions are coming in to play here. What do you want your arrays to look like after you're done pulling data from the DB and what are some example queries you would run? Is it just stuff like looking up the mean,stddev of all flows for a specific project?
|
# ? May 29, 2012 18:18 |
Long term I'm looking to build a flexible forecasting application. Imagine you have a forecast with 4 inputs: Available Targets Market Share of Available Targets Units per Target Price per Unit (resulting in Revenue) Each assumption will have a user input value for each period in the forecast horizon (e.g., Market Share in 2010, 2011, ... 2029, 2030). For each year, I want more than just a single data value to model uncertainty. If the user wants to model the uncertainty using a uniform distribution, then I'll need a Min/Max. If they want to use a normal distribution, then I'll need a Mean and Variance. All of these inputs will be used to run monte carlo simulations to determine the 10th/50th/90th percentile of the forecast. I'll then use queries and filters (likely based on a tagging system) to aggregate the data for portfolio analysis. To keep it simple, I'm just looking at having 2 inputs for each project -- Revenue and Costs. I'll still want to apply uncertainty ranges around these inputs to feel confident I can implement the approach above later on. I'm thinking my process would be: 1. Pull time series data values & statistical measures into numpy arrays for each assumption from DB 2. Use numpy/scipy stat routines to generate X amount of data points for each period 3. Use the data points to determine to calculate final revenue/costs for each year, including Min/Mean/Max and 10th/50th/90th and display information using matplotlib or Google Charts. KingNastidon fucked around with this message at 19:21 on May 29, 2012 |
|
# ? May 29, 2012 19:18 |
|
yeah then the two model approach should work just fine. You'll probably want to learn about aggregation on querysets: https://docs.djangoproject.com/en/dev/topics/db/aggregation/ It sounds like you'll mostly be pulling flows based on date ranges and then aggregating with the relevant metrics (min, max, mean, stddev, etc)
|
# ? May 29, 2012 19:25 |
I finally have a json file with the info I wanted so I'm about ready to start working on Django but I have a question. I have a 'movie' app with models for Movie, Cast, Genre and Crew. Python code:
Python code:
quote:Movie: Harry Potter and of course quote:Name: Daniel Radcliff Same thing for Crew (X as Director, Y as Writer). So, I'm not sure about how that would work. Writing a model for the characters feels like I'm doing it wrong. Any tips? lunar detritus fucked around with this message at 19:53 on May 29, 2012 |
|
# ? May 29, 2012 19:41 |
|
Your Cast needs to consist of an Actor and a Character pair. Whether you want to model each as separate tables or not is up to you. I'd make Actor an FK, and Character be just a name.
|
# ? May 29, 2012 19:44 |
|
Python code:
|
# ? May 29, 2012 19:45 |
I updated my question with something I forgot to mention in case that changes things (I want to be able to see in what movies someone has acted or which movies they have directed).Sparta posted:
I'm probably wrong but wouldn't that create a different "Daniel Radcliffe" for each character?
|
|
# ? May 29, 2012 19:55 |
|
gmq posted:I'm probably wrong but wouldn't that create a different "Daniel Radcliffe" for each character? Sorry, misunderstood the structure. Probably would include a movie = models.ForeignKey(Movie) under Cast. This would make individual entries for Daniel Radcliffe as Harry Potter, Daniel Radcliffe as Arthur Kipps. Then, when you list out the Actor and all the roles he/she has been in, you could just do Python code:
Caveat: I am still learning, someone else should check this over. e: Then, if you wanted to return a list of actors in a movie, you could just do: Python code:
|
# ? May 29, 2012 20:09 |
|
gmq posted:I'm probably wrong but wouldn't that create a different "Daniel Radcliffe" for each character? Yes, yes it would.
|
# ? May 29, 2012 20:09 |
|
|
# ? Jun 8, 2024 11:27 |
|
Sparta posted:Caveat: I am still learning, someone else should check this over. This is a bad idea. You're removing the big benefit of having a database keep all the data and build relationships. What if there are actually two separate Daniel Radcliffes that are actors? It's not uncommon to have two different actors with the same name.
|
# ? May 29, 2012 20:11 |