[Python] ./manage.py runserver on mac

Discussão em 'Python' iniciado por Stack, Maio 12, 2025.

  1. Stack

    Stack Membro Participativo

    I'm setting up a new dev environment for Django development on a mac as a new Python dev but I'm receiving an error running a basic django app so I think my python setup is incorrect

    I have python3 installed so to make it easy to access, in my .zshrc I have added the line

    alias python='python3'


    I have used homebrew to install python, django-admin, pipx as well as python-language-server and ruff-lsp and installed jedi-language-server via pipx as a basic setup for helix

    I have used the dango ninja tutorial to get a project started

    django-admin startproject ninjaapidemo
    cd ninjaapidemo


    which gives me a project structure

    # ~/dev/ninjaapidemo

    .
    ├── manage.py
    └── ninjaapidemo
    ├── __init__.py
    ├── asgi.py
    ├── settings.py
    ├── urls.py
    └── wsgi.py


    I have updated urls.py to the following (as per the django ninja tutorial)

    from django.contrib import admin
    from django.urls import path
    from ninja import NinjaAPI

    api = NinjaAPI()

    @api.get("/add")
    def add(request, a: int, b: int):
    return {"result": a + b}


    urlpatterns = [path("admin/", admin.site.urls), path("api/", api.urls)]


    and attempted to run the project from ~/dev/ninjaapidemo

    ./manage.py runserver


    but I get the following error

    env: python: No such file or directory


    Can anyone make a recommendation for what I'm doing wrong please? Thanks

    Continue reading...

Compartilhe esta Página