cj
Do I need Daphne container for docker compose?
no, Daphne is an ASGI server that Django will use when you do runserver
cj
Configuration more difficult
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/daphne/
Данил
Yeah I see😁. https://channels.readthedocs.io/en/latest/deploying.html
cj
Supervisor
many people will hate me, but... use systemd instead of that old supervisor thing
Данил
But I puzzled by this article about supervisor
cj
But I puzzled by this article about supervisor
ah well... skip that part then 😂
Данил
I hate deploying 🙈🙈🙈
Данил
Thanks very much. Tomorrow I will try second time
Данил
With Daphne
Mrinal
I've encountered a few situations in Django projects where I've experienced problems with unauthorized state changes in certain enum fields. In order to solve this issue, I've created an open source Django reusable app that helps you control the state transitions. With dj_enum you can define a set of state choices for your models and ensure that your data remains consistent by preventing illegal state change. Github repo link: https://github.com/themrinalsinha/dj_enum I would like to have some feedback and contributions to enhance its robustness. Thanks.
Данил
Hello guys, I have a question. I use unicorn webserver but cannot load page when run me site in digitalocean #docker-compose.yml services: web: build: . command: uvicorn DjangoApp.asgi:application --host 0.0.0.0 --port 8000 volumes: - static_volume:/usr/src/DjangoApp/static - media_volume:/usr/src/DjangoApp/media ports: - "80:80" env_file: - ./.env depends_on: - db What's wrong I do?
Данил
No(
Sourabh
Can we create the build of django application?
Данил
DjangoApp it's project name
Jitxs
try ports: 80:8000
Abhishek
ConnectionError at /test/ Error 22 connecting to 127.0.0.1:6379. 22. What is error ,I am building ecommerce website,to send notification to users
Abhishek
Any idea I am struck in this error
Ali
Hello guys, I have a question. I use unicorn webserver but cannot load page when run me site in digitalocean #docker-compose.yml services: web: build: . command: uvicorn DjangoApp.asgi:application --host 0.0.0.0 --port 8000 volumes: - static_volume:/usr/src/DjangoApp/static - media_volume:/usr/src/DjangoApp/media ports: - "80:80" env_file: - ./.env depends_on: - db What's wrong I do?
app: build: context: . command: > sh -c "python manage.py wait_for_db && python manage.py makemigrations && python3 manage.py migrate && daphne -b 0.0.0.0 -p 8000 backend.asgi:application" ports: - "8000:8000" volumes: - ./app:/app .... depends_on: - db Try with like that. Just change daphne section and allow 8000 port in ufw
Данил
runs correctly but site doesn't load
Данил
The following error was encountered while trying to retrieve the URL: http://46.101.115.12 Access Denied. Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect. Your cache administrator is webmaster.
Данил
in console: web-1 | 2023-11-05 10:28:56,061 INFO Starting server at tcp:port=8000:interface=0.0.0.0 web-1 | 2023-11-05 10:28:56,062 INFO HTTP/2 support not enabled (install the http2 and tls Twisted extras) web-1 | 2023-11-05 10:28:56,063 INFO Configuring endpoint tcp:port=8000:interface=0.0.0.0 web-1 | 2023-11-05 10:28:56,066 INFO Listening on TCP address 0.0.0.0:8000
Ali
Bro go enter the django app container and get container local ip with ifconfig. Then use this ip insead of server global ip
Ali
To reach the web site
Ali
Write this commands in your server sudo docker exec -it web-1 sh It'll open your web app container server Then write this ifconfig Get container ip Copy this ip and search with this url not your digitalocean server ip
Данил
just reloading all time, no effect
أسماء
Please, how can I solve error running console pycharm 2023.2.3
Данил
I have websockets but when I use Nginx, I cannot connect to them. Websockets Routes not found, what's wrong?
Maxim
@Wisely456 WTF with your PFP?
Ali
If you want I can share my nginx conf
cj
@Wisely456 WTF with your PFP?
he wants to confuse people maybe
Nihalxxxx
I uploaded a pdf file and i want to display as flipbook.. like wowbook library..how??
cj
👌?
can't you use another profile picture that is not meant to confuse people? or what are your intentions by using a pfp from an admin or from the group?
Данил
👌?
cj
@Wisely456 WTF with your PFP?
it's up to you to warn him for impersonating using PFP... you have my blessing on that
Данил
I'm warned
Rohan Ekke
Why testcase (tests.py) are done in django? What is use of test?
Ahmed
Can someone suggest me good hosting for django Vercel or render are these good for django
Данил
Can someone suggest me good hosting for django Vercel or render are these good for django
If you want something simple without docker you can try railway
cj
Why testcase (tests.py) are done in django? What is use of test?
to ensure that your code works as expected in all your use cases
Muflone
Why testcase (tests.py) are done in django? What is use of test?
models and views have methods, they have to be tested to make sure they work properly
Abil'
Why testcase (tests.py) are done in django? What is use of test?
to make sure u do not break the previously written code when adding new one.
Adisa
I am having problem with loading static files on AWS EC2 instance while trying to deploy my django project using apache2 server, gunicorn and supervisor… I have tried all the configurations but nothing seems to be working in loading the static files… someone should help please
Anonymous
Can you recommend me a good hosting for Django?
None
hi anyone know how expire or cancel a order in paypal api v2 ? (order should not payed and user cant use approve order link )
Doragonsureiyā
hi anyone know how expire or cancel a order in paypal api v2 ? (order should not payed and user cant use approve order link )
Your question is not related to Django. If it's a Python related question go to @Python group, otherwise please move to @PythonOfftopic group and ask there.
@Rp
Hi guys, is there anyone familiar with multiple database connection in django project please explain to me
Abhinand
The field admin.LogEntry.user was declared with a lazy reference to 'mainapp.customuser', but app 'mainapp' doesn't provide model 'customuser' any one know about this it occure when i am trying to create custom user model class CustomUser(AbstractUser): profile_image = models.ImageField(upload_to='media/profile', null=True, blank=True)
Boini
Guys I have an signup data in mysql database and I want to authenticate login details with using django rest framework please help
I'm
Hi everyone! I am using rest framework to send data in json format to an API. I have 2 models, User and Category. I want to send "username" from User and "name" from Category model. How can I do this? I have just one meta class in serializer class which will handle one of the models. What should I do for using both?
DeathLikeSilence
Hi everyone! I am using rest framework to send data in json format to an API. I have 2 models, User and Category. I want to send "username" from User and "name" from Category model. How can I do this? I have just one meta class in serializer class which will handle one of the models. What should I do for using both?
Can you write more detail about your project? What do you want to do with the category? I think, first of all, create a class in your model.py and in that class write your field (username, category) After that write your serializer.py. You just need a Class Meta. In that class Write your model and field You can write your serializer like this: Class see(serializer. Serializer): Class Meta: Model = your model name Fields=’’__all__’ Anyway, after that you should make some class in view.py you can use class base view or method(choose whatever u want, that depends on your project) but I recommend using class base view (APIView) You should use your serializer in your class in view.py Also, validate them if it is necessary The next item is URLs. URLs are so important because URLs are your endpoint.
Suleman
does any body habe worked on windos defender inside windows containers. i. am having issue. with that
DeathLikeSilence
Using foreign key
Yeah you can use a foreign key if you want to connect them or related In the User model, create a field like this: Username = model.Charfield() In the Category model, create a field like this: Name = model.Charfield() But unfortunately, I can not understand what you want to do with those Can u explain more???
DeathLikeSilence
What is a category about?? Or User What do u want to do??
I'm
What is a category about?? Or User What do u want to do??
Have you seen in serializer.py in class meta we use a model? I want to use two model.
Mahan
Hello, how can I tell Django not to go to the checkout page if the shopping cart is empty? And come back to this page?
Mahan
in your view's code
men i know but how tell it in view?
Believe
men i know but how tell it in view?
Use if statement. If empty render to especfic page otherwise cart page
cj
men i know but how tell it in view?
you have to check if the cart is empty and redirect to the proper page according to that validation... have you ever heard how if clause work?
cj
another option could be make a decorator for your checkout-page view, where the decorator will be in charge of checking whether the cart is empty to redirect to another page or let the user continue doing the checkout
Nishanth Siraj
Can you say what package is better for doing cron jobs in django. My research stated that celery is better but i want your opinion
Nerd
django-cron
I support this too
Bob
have anyone of u guys tried developing desktop apps using DJango? if so any tips would be greatfull
Mahan
i use this but doesent work if not cart.cart: return redirect('cart:cart')