I want to create a web application with Django. Django documentation First Django app and similar tutorials Has finished a few, and is currently studying python classes to implement the process.
Could you tell me about the following points?
When creating a web application, shouldn't the variable (instance name) for creating an instance have a different name for each user?
If multiple users execute processing on the server side, (probably) multiple instances will exist at the same time. If I can't create an instance with a unique name for each user at this time, I'm confused. Is this idea correct?
If the above idea is correct, I do not know how to create an instance with a unique name for each user.
Class Sample:
pass
user_neme = hoge
hoge_class = Sample
Is there a way to write like this?
If question 1 is correct and question 2 is impossible or inefficient, how is it solved?
Thanks for your cooperation.
-
Answer # 1
-
Answer # 2
Use a list of classes to dynamically create and delete instances
You can add/remove elements freely, and individual instances can be accessed by index
Related articles
- get a site to display dynamically with python selenium
- python - i want to dynamically change the upload destination with django, modelsimagefield
- i want to declare variables dynamically in python
- i want to dynamically change the value of a variable in python and execute it
- python - unable to create an instance using boto3 in vscode
- python : Celery. A large number of tasks in the queue
- python : How to run periodic_task?
- python : Django How can I pass a variable from views.py that contains text to an html template?
- python : Django error "NOT NULL constraint failed" while saving to database
- python : Django question, code problems
- python : Can't get two tasks running in celery in parallel
- python : How to write a decorator to check custom permissions
- python : ValidationError Django 3 not showing
- python : How to catch the crashed /not running dramatiq worker error?
- python : Why in Django when adding a position in the admin panel I get -Page not found (404)
If you use a dictionary, you can access the instance by "dictionary name [name]".