myproject
|- myapp
I have created a django project which has an app in it that does viewing , adding data to database etc. Now I want to create multiple users who can use this app with their own data. What is the best way about it.
Lets say there are 3 users user1, user2, user3. User1 works for company1 user2 works for company2 and user3 works for company3. So each user has his own data.
Currently I am planning to do this. I copy the myapp code and create 3 apps corresponding to each user. So the project directory looks something like this
myproject
|- myapp
|- myappuser1
|- myappuser2
|- myappuser3
So I now have 3 apps with similar functionality and each of the users has their own data. Now, the hurdle is how do I restrict access so that each user can see his own app. For instance, user1 should be able to only see myappuser1 contents and user2 should only see myappuser2 contents. How can I do this ? I tried creating groups in django admin but that only gives me permissions to edit the access to models under the myapp. It doesn't restrict user to see other users' pages.
Option 2: Create seperate django project for each user. This solves the user restriction but to deploy in heroku I should register each one as an app and then I have to create a unique login page through which each customer can login or else I have to give each user a different url for login.
Can you please suggest if there is a better way ?