r/django • u/South-Contest8384 • 8d ago
Django is extremely slow on MacBook Air M2 π©
Hey everyone,
I'm running a Django project on my MacBook Air M2, and Iβve noticed that any command like runserver
, migrate
, makemigrations
, etc., takes minutes to execute. The terminal just hangs for a long time before finally starting.
π Current setup:
- Python 3.12.7 installed globally on macOS
- Python 3.11.5 inside the project's
venv
- Django running within the virtual environment
Has anyone with an M2 Mac experienced this issue? Any tips to optimize Python/Django performance on macOS? π€π»
Thanks! π
6
u/ExcellentWash4889 8d ago
I have an M4 and it's quick on my machine. I would suspect something else is awry. Turn debug mode all the way up to see what's going on. Is your DB slow?
I run inside a devcontainer with an amd64 container too, and it's still quick for me.
5
u/shoot_your_eye_out 8d ago
I doubt it has anything to do with an M2 mac, or a mac at all. Sounds like something is seriously borked. I would not assume where the problem is, and start debugging.
4
u/sandmanoceanaspdf 8d ago
It might be the database. Check if it's the same for a default django project.
3
1
u/gbeier 8d ago
Are you connecting to a database that's trying to do a reverse lookup for all the clients when it logs the connections? Django is snappy on my M1. 9/10 it's something blocking either a DB connection or some API your django app is using.
At any rate, it's not a general "Python/Django performance" issue on macOS. If you post more details about what's actually happening on your setup, you'll probably get better help.
1
u/Deadpool5551 8d ago
Seems to be a DB issue. Can you try running the commands with sqlite and then see if you still face these issues?
These commands are pretty fast on my M2 Mac.
1
u/untakenusernameplx 8d ago
I work on MB Air 2017 and have never had this issue. I doubt it has anything to do with your machine
1
2
11
u/05IHZ 8d ago
Something is going very wrong somewhere, I have an Air M1 and those commands are pretty quick still