Have a little problem, tried to google it, but get nothing. What I need: Configure a URL for app in Django, like this:
/myproject/myapp/models.py
class MyApp(models.Model):
name = models.CharField()
....
/myproject/myapp/views.py
def make_something_with_app(app_id):
# will make smthing cool
Let's think, my site has a "example.com"
address, and we have two objects in DB from MyApp model - app1(id=0), app2(id=1)
.
So, what I need?
When we go to the app1.example.com
, we call make_something_with_app(0)
, and when we go to the app2.example.co
m, we call make_something_with_app(1)
Is there a way to make it? Thanks.