Welcome to the Red Eyed Coder Club channel. This channel is focused on creating videos and tutorials about Python development! Thank you for subscribing!
I think that this is not a good python code, when do in python range(2, 250001) it will create a list with each element from 2 to 250001 before do the "for". this create a horrible performace code.
in order to share a python solution create a virtual environment and install all packages to it. Everything will be in one folder. Compress it and sent to someone.
Sir what if my view does a long calls like 2 minutes, and the other user want to request to the same view. how do i implement the thread cause it is doing this sequentially
I'm on windows and i got the following issues but i was able to fix them. (Using redis from docker) #1: in the settings.py file change the variable name 'celery_broker_url' to 'CELERY_BROKER_URL' #2 if the celery -A ytDjangoChannels2 worker -l INFO doesn't print the Chuck norris quote install the eventlet library (pip install eventlet ) then add -P eventlet to the command. remaining as follows: celery -A ytDjangoChannels2 worker -l INFO -P eventlet pd: ytDjangoChannels2 is the name of my Django project Eddited: ok i had finished but the websocket doesn't receive the message only was conected so i tried a lot of things but was able to do it. First of all STOP THE CELERY COMMANDS AND LAUNCH IT TILL THE END. It could be a little obvious but when was the part of running the first time i let it and then i was trying to get the response of the web socet but i didn't had loaded the changes. i reloaded the two commands. Then i was reading a django channels tutorials and in its, the socket.onmessage method got a validation socket.onmessage = (event) => { console.log(event) const data = JSON.parse(event.data) if (data.type === 'send_joke' ){ console.log(data) document.querySelector('#jokes').innerText = data.message } and, in my consumers.py async def send_joke(self, event): text_message = event['text'] await self.send(text_data=json.dumps({ 'type': 'send_joke', 'message': text_message, })) then i was getting an error in the celery -A ytDjangoChannels2 worker -l INFO -P eventlet command which says async_to_sync(channel_layer.group_send(('jokes', {'type': 'send_joke', 'text': joke}))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: RedisChannelLayer.group_send() missing 1 required positional argument: 'message' then in my tasks.py i only add the variable async_to_sync(channel_layer.group_send)('jokes', message={'type': 'send_joke', 'text': joke}) which is the missing argument.
523871cdf88301b8317aaaea5e21b221ad20b7f6: 523871cdf88301b8317aaaea5e21b221ad20b7f6 sessid: f1ca4119d026719e398a57cf9f931740 login: login password: blabla request_type: auth помогите как решить это? откуда мне взять sesid и 523871cdf88301b8317aaaea5e21b221ad20b7f6 Причем 523871cdf88301b8317aaaea5e21b221ad20b7f6 разный
On a i5 10600k and using multi processing you can get this down to 25 seconds on python. If you use pypy's Jit you can get it down to below 5s. def process(): """Splits the task into multiple parts""" current_min = 2 tasks_per_worker = 250001 // 12 tasks = [] for _ in range(12): tasks.append( multiprocessing.Process( target=, args=(current_min, current_min + tasks_per_worker) ) ) current_min += tasks_per_worker # Start and await tasks. for task in tasks: task.start() for task in tasks: task.join()
Most kivy tutorials on youtube have the exact same content, making me think they just copy the official documentation or other videos, but this guy really does know kivy.
The code formatting on the JavaScript side hurt me. No spaces in the for loop variable declaration check and increment, no space between the closing parenthesis and the opening curly brace. Ouch
thx for the tutorial, however i don't understand how to test the response.raise_for_status() instance in the try-block in main.py, can u explain to me?
i did it today, how can i test an exception raise ? instesad of return 'some_text' how can i test through the responses methods the reaise HTTPError for example?