Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am trying to run around 50 mini sites which share about 90% of their code. My inital idea was to run them as separate applications with a common library but I have read about the sites framework which would allow them to run from a single instance.
https://docs.djangoproject.com/en/dev/ref/contrib/sites/
My question is, is the site framework the right approach to a problem like this, and does it have real benefits over running separate applications.
The sites framework is likely perfect for what you are doing. Generally, it allows you to use the same architecture and functionality across a variety of extremely similar sites. The main benefit is that instead of having to manage 50 different servers, or 50 different instances of Django running, that you can maintain 1 instance of Django. That includes database migrations, deployments, etc.
The sites framework is mostly useful to implement "multi tenancy" in your database - different sets of data belonging to different sites/instances, all in the same database.
Along with this you can define a hostname for each site.
But your SITE_ID is set in settings.py, so in order to have multiple sites, you need multiple settings.py configurations, which means multiple distinct processes/instances. You can of course share the code base between them, but each site will need a dedicated worker / WSGIDaemon to serve the site.
Alternatively, you can use django_layers (a package I wrote) to serve different sites (with different templates, static resources, and so on) from a single instance.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
We have legacy .exe solution running on industrial client's desktops that I need to port over to Google App Engine. All clients will have the same version of the app, no code customization. We need to be sure that data will not be leaked between different clients of the new GAE app or be snooped on by some external party.
So I have a couple of questions that I hope someone will be able to help me out.
Option 1: Use namespaces to separate client's data. This seems quite robust at the Datastore level; without the proper namespace data would not be served. Since we have the company name of each user, I would presume this would be quite secure against leaks.
Q1: Which precautions do I need to take to avoid someone guessing or hacking at URLs to get to unauthorized data?
Option 2: We could have a separate instance of the code and datastore for each client. This would give the optimal separation between clients.
Q2: Is there a tool or API to "clone" a given GAE app to many clients? We would feed the list of clients and update the code to all those instances in one go.
Thanks!
Which precautions do I need to take to avoid someone guessing or hacking at URLs to get to unauthorized data?
Namespaces are not a security mechanism for Datastore. A user with access to one partition in a project has access to all partitions in the project. Namespaces provide a way to organize your entities within a project.
Is there a tool or API to "clone" a given GAE app to many clients? We would feed the list of clients and update the code to all those instances in one go.
To have completely isolated instances of services, you can create new projects programmatically using the Cloud Resource Manager API and access resources across projects.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I am thinking of creating a content delivery web application using Django with a MySQL database, and after reading the docs a bit I noted that it is possible to create multiple apps in the same project/site directory.
It may or may not apply to what I want to do, but I was wondering what the motivation behind this architecture is. Why would I want multiple web apps in one site?
For example, Youtube was built around the Django framework, but the entire experience works seamlessly as one application? Is Youtube actually one large web application, or does the project use many applications packaged as one product? If so, why would that be a better option?
There's a good explanation about it in the django docs here and here.
From my own experience: it helps you to organize your code. If you're planning to create a small application it may not need more than one django application. But it you want to create medium or large applications you can take advantages of this approach. Some of useful cases:
Authentication
Blog
Split your RESTFul API based on resources (e.g. clients, invoices, users, etc)
Logging
Chat
Hope that helps a bit.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
i have to develop a Real Time Application that supports thousands of users with Python. The question: decide which framework and architecture use.
The first option is:
Falcon only (Admin and API)
The second:
Tornado manage request, Admin runs Django and API runs Falcon
Another problem is database. Could be one only RethinkDB (1st option), or two, with Postgresql (2nd option).
Which of these option is the best? Should try something different?
PD: One fancy implementation could be with Tornado sockets
I think your question needs to be more specific.
Without more detail about the application my general suggestion would be to not complicate things by using many frameworks, just pick one that does everything you need.
Unless you are planning to design an asynchronous API forget about Tornado. If your application is very small and has a simple API then you could consider Falcon because of it's short learning curve. Otherwise I'd suggest going with Django.
As for the DB, it's nearly impossible to provide a suggestion without understanding what type of data you are planning to store? What is your expected read/write ratio? Do you already have operational experience with any DBs?
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I recently got into Django out of curiosity after developing for quite a while w/ Ruby on Rails and Node.js, and found that it's splendid for working w/ databases. Django is primarily known for working with databases and every tutorial I've ever found on it has included databases. Django supports not requiring databases however, and, just out of curiosity since I'm still rather inexperienced w/ Django, what would be some practical uses w/ Django w/out requiring databases?
I do not recommend using Django if you are not interested in using a database. Having written that disclaimer, if you insist on still using it, you can just scan over the documentation and identify what is still available to you if you do not have a database:
You can use Django's security features to help protect against clickjacking, cross site request forgeries, etc.
You can take advantage of Django's support for internationalization if you want to support multiple languages on your website.
You can have Django handle validation of any forms you have on your website.
...basically you can create a static website that takes advantage of the rapid prototyping enabled by a framework built using Python.
I can't think of many if I'm honest. If you are writing a web application that doesn't need to store to retrieve things from some sort of storage then using a whole Django project is probably total overkill.
A blog wouldn't really require a database if you only had a single user who was willing to add posts by adding files manually, but something like Jekell would be better for that.
You could create a web app that would interact with the server it's on. For example, you could create a web page that called a unix command when you hit a create webpage. You would be able to use to this create some sort of dashboard for your server or maybe provide a cleaner user interface for things that you could do with ssh. However, Django might be overkill for this, something like Flask might work better as you would have a lot less overhead.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
There is a lot going on in web frameworks - they can take an age to learn.
So, what is it I am missing when I say that WSGI defines pretty much all we need to respond to a request. If I overload the environ dict I can store almost all I need, so what am I gaining from a framework?
You can certainly write a web application using only WSGI, but at some point you're going to have to solve the following problems:
How do I handle different url requests?
How do I parse form data?
How do I render a response?
How do I support sessions?
How do I persist data?
etc, etc, etc...
Each web framework solves some (or all) of these problems. Yes, you could design and implement solutions yourself, but web frameworks contain solutions that other people have found work very well for them. So that's what you get from a framework: a bunch of suggestions for how to solve common problems when writing web apps.
Finally, it's easy to be overwhelmed by the number of choices for web frameworks, but if you just learn one, others will be much easier to understand. I would recommend learning either django or a more minimalist framework like flask. Other frameworks are pretty similar to these two, and you'll be able to pick them up easily.