running django-admin as a python module

I can’t seem to run some exe files on my work laptop.

Instead of pip install django djangorestframework I managed to workaround with python -m pip install django djangorestframework

Now django-admin startproject RestaurantCore . is showing this :

(env) PS D:\workspace\django\menu-api> django-admin startproject RestaurantCore .
Program 'django-admin.exe' failed to run: Access is deniedAt line:1 char:1
+ django-admin startproject RestaurantCore .
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
At line:1 char:1
+ django-admin startproject RestaurantCore .
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
    + FullyQualifiedErrorId : NativeCommandFailed

But how can I get around this by doing something like python -m django-admin startproject RestaurantCore . ?

Because the above returns No module named django-admin

Your error message above already tell us what’s wrong. django-admin is a command or executable program by django-admin.exe. It’s not a python module. Anything that you can import and it’s has __main__.py you can invoke it using python -m modulename. In this case, you must be able to do import modulename in the python console.

As for django, the way to invoke the management command is through python -m django. You can look it here:-

Thanks. This worked.

python -m django startproject RestaurantCore .