Forums

Creating a new app/database etc. programmatically?

I've still got a lot of development to do, but I may end up building my app in a way that it can be resold. Is there any way for me to set up a service that will create subdomains, apps and databases without me having to come into the GUI and do it?

For ex, customer signs at MyAwesomeApp.com, and creates a user which generates a copy of my app at CustomerUsername.MyAwsomeApp.com with it's own database and threads?

(obviously this would be on a paid account, im still building :) )

Do you mean your app needs to create a new PA user?

Unfortunately there isn't a way to do that right now. We might add support for a single app being able to handle multiple subdomains in the future, but it's not on the roadmap right now. (Perhaps it should be? Thoughts welcome!)

One exception to the above -- you can certainly add new databases from your code -- just issue a "CREATE DATABASE" SQL command to MySQL. But you can't create new web apps or handle subdomains.

In general, if you're building an app for multiple clients, that might not be the best thing to do anyway, as it probably wouldn't scale very well. It would make more sense to have one app handling multiple clients and structure the database so that they all see separate datasets in it.

What I'm building is essentially a CRM and invoicing app for a small business. I'm not real sure how that would work in terms of CPI with businessA and businessB customers and invoices being stored in the same tables. Was thinking it would be better to have each cutomer given their own database, but I'm not really a database guy (yay django orm). Is that just really a horrible idea?

It would be unusual, certainly. What do you mean by CPI? I can't find a relevant meaning on Wikipedia...

Oh sorry. Customer Proprietary Information. Basically identifying information of customers.

After giving it some thought, I think you could solve pretty much everything on your list (assuming your users don't mind waiting because the whole process would take quite a long time), except for programmatically creating a new PythonAnywhere web app.

That said, it may not be a good idea unless your users are individually quite valuable because a PythonAnywhere web app is extremely expensive when you compare it to a few rows (or a few million) in a database. Also bear in mind that pretty much every B2B web site in the world is based on storing CPI from multiple clients in the same table and just having good security and access constraints to keep them separate.

Ok. That pretty well answers my questions then. I was thinking about the db design of it over the last couple days and I think I came up with something that will work pretty well in terms of table relationships.

Thanks for the input guys!