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.
 
  • Post
  • Reply
German Joey
Dec 18, 2004

Suspicious Dish posted:

This has already been solved. Look up "input prediction" and "lag compensation".

Yes, this is what I'm trying to do. How can I do it here without having forcing the need for two different sets of code?

Adbot
ADBOT LOVES YOU

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

German Joey posted:

Yes, this is what I'm trying to do. How can I do it here without having forcing the need for two different sets of code?

Both lag compensation and input prediction require different code on both the client and server. You don't have to have two different sets of code, you just have the client part in JavaScript, and the server part in Python.

ufarn
May 30, 2009

Maluco Marinero posted:

AJAX Events are still restful so itll work just like a normal view. The question is how you want to handle non logged in users, because if you don't want to redirect but want something returned to the page, you'll probably be better off with your own decorator or mixin.
I've tried to implement it without any luck. Here's an example:

code:
    $(".follow").click(function() {
        var $this     = $(this);
        var person_id = this.id;
        var text      = $this.text();

        $.post("/user/follow/", {
            person_id: person_id,
            text:      text
            },
            function(data) {
                $this.text(data);
        });
    });
});
code:
@login_required
def follow(request):
    if request.is_ajax() and request.method == "POST":     
        person_id = request.POST['person_id']
        person    = get_object_or_404(User, pk=person_id)
        text      = request.POST['text'].lower()

        if text.startswith("follow"):
            request.user.get_profile().follows.add(person)
            new_text = "Unfollow user"
        elif text.startswith("unfollow"):
            request.user.get_profile().follows.remove(person)
            new_text = "Follow user"

        return HttpResponse(new_text)
This doesn't currently work. What am I screwing up?

German Joey
Dec 18, 2004

Suspicious Dish posted:

Both lag compensation and input prediction require different code on both the client and server. You don't have to have two different sets of code, you just have the client part in JavaScript, and the server part in Python.


Yes, again, NO loving poo poo. Hence the original post asking how I can link Python and Javascript, because I know both Python and Javascript are needed. However, although both are needed, I still do not want there to be two different sets of code describing "this is the formula for evading an attack" or "this is what how the monster decides what spell to cast this turn" so that when the designer decides that behaivor needs to change, it doesn't cause everything to get hosed up. Even if the end-result being that two different sets of code are needed, I'd still like the user to only need to write one set with the other set being "handled" somehow by the engine.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

ufarn posted:

This doesn't currently work. What am I screwing up?

You're probably forgetting about the CSRF protection. Use something like the jQuery cookie extension and:

code:
if (!$.ajaxSettings.headers)
    $.ajaxSettings.headers = {};

$.ajaxSettings.headers['X-CSRFToken'] = $.cookie('csrftoken');

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

German Joey posted:

Yes, again, NO loving poo poo.

Woah, sorry. I misread your original post and response.

Anyway, first of all, I'm not sure that Django is a good fit for a real-time thing like this. Something that can integrate with WebSockets for real-time server to client communication (rather than long-polling via AJAX) might be better. For something written in Python, you can try Twisted + WebSockets, but you'll still have the same issue of the Python/JavaScript disconnect.

If your goal is "server and client parts are both written in JavaScript", have you considered using node.js or another JS server?

EDIT: I don't think multi-language embedding is ever a good idea like this. If you want to concoct a solution where you fork out to SpiderMonkey and communicate over an fd with JSON (which is what Python-SpiderMonkey does, effectively), go ahead. pyjamas is a false start. PyPy used to have a javascript backend, but it has since been dropped because it's unmaintained. re: Python on the client, you could try using skulpt or emscripten, but ugh is that a terrible idea just use Python everywhere or JavaScript everywhere.

Suspicious Dish fucked around with this message at 20:25 on Apr 20, 2012

ufarn
May 30, 2009

Suspicious Dish posted:

You're probably forgetting about the CSRF protection. Use something like the jQuery cookie extension and:

code:
if (!$.ajaxSettings.headers)
    $.ajaxSettings.headers = {};

$.ajaxSettings.headers['X-CSRFToken'] = $.cookie('csrftoken');
I can get the events to work, when I am logged in, just not for users who aren't. This is the part I cut off the code example that's in the actual js:


code:
// This CSRF token allows us to make POST requests
    $(document).ajaxSend(function(event, xhr, settings) {
        function getCookie(name) {
            var cookieValue = null;
            if (document.cookie && document.cookie != '') {
                var cookies = document.cookie.split(';');
                for (var i = 0; i < cookies.length; i++) {
                    var cookie = jQuery.trim(cookies[i]);
                    // Does this cookie string begin with the name we want?
                    if (cookie.substring(0, name.length + 1) == (name + '=')) {
                        cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                        break;
                    }
                }
            }
            return cookieValue;
        }
        function sameOrigin(url) {
            // url could be relative or scheme relative or absolute
            var host = document.location.host; // host + port
            var protocol = document.location.protocol;
            var sr_origin = '//' + host;
            var origin = protocol + sr_origin;
            // Allow absolute or scheme relative URLs to same origin
            return (url == origin || url.slice(0, origin.length + 1) == origin + '/') ||
                (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') ||
                // or any other URL that isn't scheme relative or absolute i.e relative.
                !(/^(\/\/|http:|https:).*/.test(url));
        }
        function safeMethod(method) {
            return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
        }

        if (!safeMethod(settings.type) && sameOrigin(settings.url)) {
            xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
        }
    });
I'll try to fire up Firebug later and see, if it detects the problem.

OnceIWasAnOstrich
Jul 22, 2006

I'm having a problem making a custom filter.

I've got an app 'pricetracker' installed in my settings.py, and I have a file 'project/pricetracker/templatetags/tag_extra.py', in a folder with an empty __init__.py, that contains :

code:
from django import template

register = template.Library()

@register.filter(name='fadd')
def fadd(value, arg):
    return "%.2f" % (float(value)+float(arg))
If I did this right this should mean that this filter should automatically show up in django.templatetags. I've gone ahead and added { % load tag_extra % } to my template and tried using the tag and I get
code:
Exception Type:	TemplateSyntaxError
Exception Value:	
Invalid filter: 'fadd'
Additionally, when I python manage.py shell and try to 'from django.templatetags import tag_extra' it doesn't find anything to import. I'm kind of lost, because every mention of this error on Google seems to be a result of a problem that (I think) I'm not having.

Innocent Bystander
May 8, 2007
Born in the LOLbarn.
It should be be available when you import pricetracker.templatetags.tag_extra.fadd and then try to use fadd. If you want to use it in your template you should need to put in a:

{% load tag_extra %}

Then use your tag

OnceIWasAnOstrich
Jul 22, 2006

Innocent Bystander posted:

It should be be available when you import pricetracker.templatetags.tag_extra.fadd and then try to use fadd. If you want to use it in your template you should need to put in a:

{% load tag_extra %}

Then use your tag

Turns out I actually had everything correct, it just wasn't loading until I restarted the Django server.

Fangs404
Dec 20, 2004

I time bomb.
I have kind of an unusual question. Part of the website I'm working on allows the admin to enter some custom HTML which will contain an HTML form. This raw HTML is then presented to the user. The user can fill out the form and hit submit, and then my code iterates over all returned values and stores them in the DB (I just build what is essentially a single line in a CSV file). The reason it's done this way is because the surveys the admin designs are much more complicated (in format) than any survey builder I've found is capable of building. She's very particular about how the survey looks. This site is a rewrite of an older site, and this is the way it's gotta be done until I can write a survey builder complex enough to satisfy her needs.

Anyway, my question regards sanitization. I'm doing for key, values in sorted(request.POST.iterlists()): and building the CSV string using the key/values mappings. Do I need to worry about manually sanitizing key and values before storing them in the DB? Normally, I'd create a Form and just do form.cleaned_data, but that obviously doesn't work here. I can't find clear documentation telling me when the sanitization process occurs in Django, so I'm not sure if I can trust these data. If I can't trust them, what's the best way to sanitize them?

Thanks!

[edit]
I just found this StackOverflow question which seems to tell me that Django's ORM will handle this. So I don't need to worry, right?

Fangs404 fucked around with this message at 21:04 on May 2, 2012

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.
Have a look through this. When save is called, clean_fields is called, which runs the validator for each field. As far as I know that covers removing malicious input, but thatd be the methods to check.

https://docs.djangoproject.com/en/dev/ref/models/instances

edit: I'm a tool, seeing as I just learned about this when I was building a do / undo framework, and you're right. Save doesn't call model validation. Serves me right for answering a question hung over, sorry :)

Maluco Marinero fucked around with this message at 06:28 on May 3, 2012

Fangs404
Dec 20, 2004

I time bomb.

Maluco Marinero posted:

Have a look through this. When save is called, clean_fields is called, which runs the validator for each field. As far as I know that covers removing malicious input, but thatd be the methods to check.

https://docs.djangoproject.com/en/dev/ref/models/instances

Not that I don't believe you, but I don't see anywhere in the docs where it says that save calls clean_fields. All I see is that save doesn't call full_clean. Is this what I should be doing?:

code:
survey_results = SurveyResponse(survey=survey, ip_address=request.META['REMOTE_ADDR'], csv_results=csv_results)
survey_results.full_clean()
survey_results.save()
csv_results contains the string I build from what comes out of POST. Is the full_clean call not necessary?

[edit]
After digging around, it looks like the proper way to do this is by overriding the model's save method like this:

code:
class SurveyResponse(models.Model):
	survey = models.ForeignKey(Survey)
	timestamp = models.DateTimeField(auto_now_add=True)
	ip_address = models.CharField(max_length=15) #xxx.xxx.xxx.xxx
	csv_results = models.TextField()

	#make sure full_clean() is called whenever a new response is submitted
	def save(self, *args, **kwargs):
		self.full_clean()
		super(SurveyResponse, self).save(*args, **kwargs)
[edit2]
After actually playing around and trying "; DELETE * FROM surveys_surveyresponse; as a string response, it turns out that save does appear to sanitize the input correctly (it escapes the quote and turns it into ""). So I can just toss the raw POST data into the model, and save will make sure it's safe. Phew.

Thanks!

Fangs404 fucked around with this message at 05:53 on May 3, 2012

Comrade Gritty
Sep 19, 2011

This Machine Kills Fascists

Fangs404 posted:

Not that I don't believe you, but I don't see anywhere in the docs where it says that save calls clean_fields. All I see is that save doesn't call full_clean. Is this what I should be doing?:

code:
survey_results = SurveyResponse(survey=survey, ip_address=request.META['REMOTE_ADDR'], csv_results=csv_results)
survey_results.full_clean()
survey_results.save()
csv_results contains the string I build from what comes out of POST. Is the full_clean call not necessary?

[edit]
After digging around, it looks like the proper way to do this is by overriding the model's save method like this:

code:
class SurveyResponse(models.Model):
	survey = models.ForeignKey(Survey)
	timestamp = models.DateTimeField(auto_now_add=True)
	ip_address = models.CharField(max_length=15) #xxx.xxx.xxx.xxx
	csv_results = models.TextField()

	#make sure full_clean() is called whenever a new response is submitted
	def save(self, *args, **kwargs):
		self.full_clean()
		super(SurveyResponse, self).save(*args, **kwargs)
[edit2]
After actually playing around and trying "; DELETE * FROM surveys_surveyresponse; as a string response, it turns out that save does appear to sanitize the input correctly (it escapes the quote and turns it into ""). So I can just toss the raw POST data into the model, and save will make sure it's safe. Phew.

Thanks!

Django's ORM properly prevents SQL injection. It does this using parameterized queries. What Model/Form Validation does is allow you to check for bad values and present a useful message to the end user.

For example a models.URLField is just stored in the database as CharField, infact you can very well put things in an URLField that doesn't belong there by not calling clean (e.g. MyModel.url_field = "java script://alert('lol xss')"; MyModel.save(). if you had called full_clean on that it would throw a ValidationError since java script:// isn't an allowed value in the field.

Essentially they are used for constraints that the database can't (without triggers or advanced types not available on all systems) support.

deimos
Nov 30, 2006

Forget it man this bat is whack, it's got poobrain!
Way to cancel Open Django East on me king_kilr! :mad: This sucks, trip cancelation will cost me moolah.

(I know it's not his fault.)

Jo
Jan 24, 2005

:allears:
Soiled Meat
I have a Vote model in my application which I'd like to see applied to both tags and comments.

code:
class Vote(models.Model):
	target = models.ForeignKey(???);
	direction = models.DecimalField();
	user = models.ForeignKey(User);
Though once I had separate tag votes and comment votes, now they're unified and I'd like to be able to specify foreign keys as either a Comment or Tag. Is there a way to do this without separate foreign keys?

Jo fucked around with this message at 21:19 on May 7, 2012

Nimrod
Sep 20, 2003
I'm pretty new to Python/Django in general, but I was able to get a basic blog rolled out without too much trouble.

I think that so far what I like most is the templating language. Compared to Wordpress, it's a breeze to figure out and use and a lot of the built in filters are great too.

Also that guide in the OP is horribly out of date.


http://james-olson.com/ is the site I wrote, and launched on an AWS instance.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.
Speaking of templating, does anyone else use hamlpy, the port of Ruby's haml. All it does is run a watcher than converts them to native django temples during development, but hamlpy is a really nice whitespace aware language.

It makes my templates heaps more readable and you can always drop back to standard django inside the template.

necrobobsledder
Mar 21, 2005
Lay down your soul to the gods rock 'n roll
Nap Ghost

Jo posted:

I have a Vote model in my application which I'd like to see applied to both tags and comments.

code:
class Vote(models.Model):
	target = models.ForeignKey(???);
	direction = models.DecimalField();
	user = models.ForeignKey(User);
Though once I had separate tag votes and comment votes, now they're unified and I'd like to be able to specify foreign keys as either a Comment or Tag. Is there a way to do this without separate foreign keys?
I'd be a bit concerned about confusing a key meant for a Comment rather than a Tag with a single field. Unless you have a single key space used for both comments and tags (think: id 1 can't be valid in both a Comment and Tag table and refer to one of the two just by the foreign key) where you perform some form of model / key inheritance you'll likely find having another column easier to implement. Otherwise, an intermediate table (say, using "through") that both Comment and Tag refer to as their "parent" would be the solution and so every Comment and Tag will have a foreign key to this "VoteReference" table. The plus side is that all you have to do to add Voting to another model would be to create a one-to-one relationship with that table.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Jo posted:

I have a Vote model in my application which I'd like to see applied to both tags and comments.

code:
class Vote(models.Model):
	target = models.ForeignKey(???);
	direction = models.DecimalField();
	user = models.ForeignKey(User);
Though once I had separate tag votes and comment votes, now they're unified and I'd like to be able to specify foreign keys as either a Comment or Tag. Is there a way to do this without separate foreign keys?

The dumb idea would be to use contenttype. Don't do that. I'd say that these deserve separate tables, rather than one table. Something like:

code:
class VoteBase(Model):
    direction = models.DecimalField()
    user = models.ForeignKey(User)

class TagVote(VoteBase):
    target = models.ForeignKey(Tag)

class CommentVote(VoteBase):
    target = models.ForiegnKey(Comment)
would work, except I forget if you can make VoteBase be a skeleton model with no actual table, and have TagVote/CommentVote each one table with three columns.

SlightlyMadman
Jan 14, 2005

You could also go the other way and make Tag and Comment both inherit a "Votable" base class, and have the vote just reference a Votable FK.

Jo
Jan 24, 2005

:allears:
Soiled Meat

SlightlyMadman posted:

You could also go the other way and make Tag and Comment both inherit a "Votable" base class, and have the vote just reference a Votable FK.

I kinda' like this solution. Will probably end up doing something like it. Thanks, everyone.

fuf
Sep 12, 2004

haha

Nimrod posted:


Also that guide in the OP is horribly out of date.


Oh, really? I was just about to go through it.

Do people have recommendations for something similar that is up to date? I was planning to get started with django by making a really simple blog.

ufarn
May 30, 2009
SA's design doesn't lend itself very well to long-form code OPs, sadly.

I don't think it looks all that obsolete, and upgrading to Django 1.4 doesn't require much except for changing your directory structure to moving the apps to the root folder instead of the project folder.

Django By Example is a great series that should be in the OP.

fuf
Sep 12, 2004

haha

ufarn posted:

Django By Example is a great series that should be in the OP.

This looks perfect, thanks.

What about http://www.djangobook.com/en/2.0/ ? Still worthwhile?

ufarn
May 30, 2009

fuf posted:

This looks perfect, thanks.

What about http://www.djangobook.com/en/2.0/ ? Still worthwhile?
It will always be the best introduction to Django, woefully obsolete as it is. It's the tutorial Django deserves, but never really got, because it explains not just the Whats of Django, but also the Hows and Whys. It's a great argument against the criticism of Django as something clogged and clunky, when in fact it's the organic result of what people in publishing needed and developed.

Include it with the warning that there is no guarantee that the code examples will work, and that they should make good use of the guide comments that fix most of these incompatibilities.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

ufarn posted:

It will always be the best introduction to Django, woefully obsolete as it is. It's the tutorial Django deserves, but never really got, because it explains not just the Whats of Django, but also the Hows and Whys. It's a great argument against the criticism of Django as something clogged and clunky, when in fact it's the organic result of what people in publishing needed and developed.

Include it with the warning that there is no guarantee that the code examples will work, and that they should make good use of the guide comments that fix most of these incompatibilities.

Yeah, the documentation is great for finding out implementation details, but Django Book really helped me align my thinking with how to use Django correctly.

Nimrod
Sep 20, 2003

fuf posted:

Oh, really? I was just about to go through it.

Do people have recommendations for something similar that is up to date? I was planning to get started with django by making a really simple blog.

Yeah, the OP does a few things, like:
maxlength is now max_length
To get any of your models to show in the admin panel, you now need to register them.
__str__ is used throughout the OP instead of __unicode__, but to be fair it IS corrected near the top of the post, just not at any place after.

The Django Docs/Django Book together were a better resources.

other people
Jun 27, 2004
Associate Christ
Excuse me if this is out of place, but can some one explain to me or point me in the right direction with regards to running python with lighttpd? I gather I need wsgi? Or fast_cgi? Or huh?

This is the closest thing I have found, and it does not help me one bit. http://redmine.lighttpd.net/projects/4/wiki/Howto_WSGI

I have set up PHP, and that was pretty straight forward.

OnceIWasAnOstrich
Jul 22, 2006

Kaluza-Klein posted:

Excuse me if this is out of place, but can some one explain to me or point me in the right direction with regards to running python with lighttpd? I gather I need wsgi? Or fast_cgi? Or huh?

This is the closest thing I have found, and it does not help me one bit. http://redmine.lighttpd.net/projects/4/wiki/Howto_WSGI

I have set up PHP, and that was pretty straight forward.

With Python you aren't inserting code into your HTML and letting the webserver execute it like with PHP. You generally use a Python web framework, something as complicated as Django to Pylons/Pyramid or to something very basic like Bottle. You then run that framework (or I guess your own app if you really want to do it yourself) with a WSGI server like gunicorn, paste, cherrypy or the like. You COULD just run that, but you should proxy to that with apache/lighttpd/nginx.

Hed
Mar 31, 2004

Fun Shoe
You need to install python flup. Once you can import that, set up lighttpd to talk fastcgi on a specific port (not your external web port), then run manage.py in fastcgi mode to talk to the same port. I think the Django docs on this should get you there.

Lamacq
Jun 15, 2001

Breezeblock RIP

Kaluza-Klein posted:

Excuse me if this is out of place, but can some one explain to me or point me in the right direction with regards to running python with lighttpd? I gather I need wsgi? Or fast_cgi? Or huh?

This is the closest thing I have found, and it does not help me one bit. http://redmine.lighttpd.net/projects/4/wiki/Howto_WSGI

I have set up PHP, and that was pretty straight forward.

There's kind of a lot of stuff you have to wrap your head around with WSGI deployment, it is definitely not as straightforward as PHP. Here is a list of WSGI servers: http://www.wsgi.org/en/latest/servers.html

I personally use apache mod_wsgi in production, but will be moving to uWSGI soon-ish. The basic idea is you have a front end web server (nginx in my case, but you can use apache or lighttpd) which knows how to pass through requests meant for the wsgi application to the proper wsgi server, which is running as some other process. You'll write a short wsgi script for your application (django 1.4 ships with an example wsgi script when you run `python manage.py startproject`), start up the wsgi server and pass it your wsgi script, and then configure the web server to pass through requests to the wsgi server.

e: I recommend uWSGI over the other wsgi servers mentioned above. Looks like there is even a wiki page for using it with lighttpd specifically: http://projects.unbit.it/uwsgi/wiki/RunOnLighttpd (although it looks like you'd have to recompile lighttpd to use it, ugh. I also recommend moving to nginx if you can :) )

Lamacq fucked around with this message at 22:39 on May 15, 2012

Jo
Jan 24, 2005

:allears:
Soiled Meat
I have an application nearing completion, but I have no idea how hard it's going to hit memory, CPU, or the database. What are my options in terms of hosting it for a small group of people to test? Am I stuck with my local machine?

fuf
Sep 12, 2004

haha

Jo posted:

I have an application nearing completion, but I have no idea how hard it's going to hit memory, CPU, or the database. What are my options in terms of hosting it for a small group of people to test? Am I stuck with my local machine?

I just asked a pretty similar question in the hosting thread. I'm looking for some cheap shared hosting that has django support.

http://www.webfaction.com/ looks like it could be good, but I'd like to get some other opinions.

SlightlyMadman
Jan 14, 2005

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.

http://www.webfaction.com/ looks like it could be good, but I'd like to get some other opinions.

I run a Django site on DreamHost and it works great.

They have an entire section about it in their wiki, and simple step-by-step instructions:
http://wiki.dreamhost.com/Django

Here's a $50 off coupon code: SLIGHTLYMADMAN50 (disclaimer: I get a referral bonus too)
http://www.dreamhost.com/r.cgi?265655

Jo
Jan 24, 2005

:allears:
Soiled Meat
I just want to be sure my IO operations are reasonable before I dump it on Dreamhost or someone. I have the niggling fear that one of my operations is going to completely obliterate the CPU and disk when more than ten or twenty people use it. (Yay perceptual image hashing.) I don't want to end up with a bill for $500 worth of memory/bandwidth/diskio overage, but I suppose if they'll just shut off service, that might be better.

Side note: what is the most accepted way to do fuzzy string matching on the DB side? Right now I'm using a hack that looks like this:

code:
	algo_name = request.POST['algorithm'];
	upload = request.FILES['img'];
	data_file = StringIO(upload.read());
	img = Image.open(data_file);
	imghash = ImageHash.run_algorithm(algo_name, img);

	results_raw = list();
	for feat in Feature.objects.filter(algorithm=algo_name):
		dist = ImageHash.distance(algo_name, imghash, feat.data);
		if dist < MATCH_THRESHOLD:
			results_raw.append((dist, feat.pic));
	results_raw.sort();

	results = [result[1] for result in results_raw];

	return render_to_response('search.html', {"results" : results, "algorithms" : ImageHash.ALGORITHM_NAMES});
for feat in Feature.objects.filter(algorithm=algo_name) is selecting EVERY HASH created by a given algorithm, then I'm just finding which image has the smallest distance. I'm sure there's a better way to do this in the database, but the exact terms elude me. Database Linking? DLsomething?

EDIT: Table breakage.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
Just put it up on an amazon ec2 server, they charge flat rates on stuff like disk* and cpu usage.

* Only on their local storage, if you use the EBS storage then those have usage charges $0.10 per 1 million I/O requests. I payed 16 bucks last month and I have thousands of users downloading videos off of EBS volumes.

SlightlyMadman
Jan 14, 2005

MEAT TREAT posted:

Just put it up on an amazon ec2 server, they charge flat rates on stuff like disk* and cpu usage.

* Only on their local storage, if you use the EBS storage then those have usage charges $0.10 per 1 million I/O requests. I payed 16 bucks last month and I have thousands of users downloading videos off of EBS volumes.

Amazon is definitely the way to go if you can spend a couple bucks more and don't mind being your own sysadmin. I've got a few sites up there and it works great, just make sure you back poo poo up yourself, because they do have occasional server failures and don't perform any sort of backups themselves.

deimos
Nov 30, 2006

Forget it man this bat is whack, it's got poobrain!

SlightlyMadman posted:

Amazon is definitely the way to go if you can spend a couple bucks more and don't mind being your own sysadmin. I've got a few sites up there and it works great, just make sure you back poo poo up yourself, because they do have occasional server failures and don't perform any sort of backups themselves.

Not only this, but AWS has free tiers for which you might qualify, if you ever launch the site you can probably hand off half the poo poo to AWS anyways: database to RDS, caching to ElastiCache, content delivery to cloudfront, etc.

As a general note, CloudFront is a ridiculously good CDN for the price, specially the latest iteration that got launched a few days ago.

Adbot
ADBOT LOVES YOU

SlightlyMadman
Jan 14, 2005

deimos posted:

Not only this, but AWS has free tiers for which you might qualify, if you ever launch the site you can probably hand off half the poo poo to AWS anyways: database to RDS, caching to ElastiCache, content delivery to cloudfront, etc.

As a general note, CloudFront is a ridiculously good CDN for the price, specially the latest iteration that got launched a few days ago.

For some reason I've never managed to get a micro server to qualify for the free tier, but regardless a micro instance is about the same price as a shared hosting plan if your requirements aren't much it's not a bad deal. You can also resize it later if you need more.

I have my Dreamhost account that runs my email, file server, and a dozen websites that don't get a ton of traffic, then an Amazon account where I launch anything that's "serious business."

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply