0

when I'm using Visual Studio Code for the Django project in windows Environment, for creating a superuser I'm using the below command.

(test) C:\Users\SAHEB\projects\project>python manage.py createsuperuser

this same Django project is deployed in Unix server, below is the path where whole project is deployed.

/apps/sample/python

but python manage.py createsuperuser this command is not working in Unix server from this path, what's the solution

Urm
  • 3
  • 3

2 Answers2

0

from_the_docs: runserver is to start a server and not to create superuser.

from_the_docs: To create superuser run following command:

django-admin createsuperuser
  • Sorry, I put the wrong command, I have edited my question.Thanks – Urm Aug 20 '20 at 10:52
  • django-admin createsuperuser command is not working in unix environment – Urm Aug 20 '20 at 10:54
  • are you running it from same directory as **manage.py** ? – from_the_docs Aug 20 '20 at 11:07
  • yes from the same directory, it's showing there is no subcommand like 'createsuperuser' – Urm Aug 20 '20 at 11:18
  • what error or infomation are you getting? what it says? what's output when you run **python manage.py createsuperuser**? – from_the_docs Aug 20 '20 at 11:20
  • python manage.py createsuperuser Traceback (most recent call last): File "manage.py", line 8, in from django.core.management import execute_from_command_line ImportError: No module named django.core.management – Urm Aug 20 '20 at 11:41
  • you sure you have **django** installed in your test environment? you can see list of installed libraries/modules using `pip freeze`. what's output of `pip freeze | grep django` are you getting? – from_the_docs Aug 20 '20 at 11:48
  • Django==1.8 is installed, I have checked requirment.txt file – Urm Aug 20 '20 at 11:55
  • checkout this question and let know: https://stackoverflow.com/questions/14013728/django-no-module-named-django-core-management – from_the_docs Aug 20 '20 at 11:59
  • also instead of checkint requirements.txt manually can you can try running `pip freeze | grep django` to make sure you have it installed in the python environment you are using to run this command. – from_the_docs Aug 20 '20 at 12:00
  • after using 'pip freeze | grep django ' it's not showing any version of python – Urm Aug 20 '20 at 12:12
  • hmm, this means that django isn't installed in your current python environment. try running: *pip install -r requirements.txt" – from_the_docs Aug 20 '20 at 12:14
  • Is it possible to check in which environment Django is installed in unix server? – Urm Aug 20 '20 at 12:18
  • ^idk, be safe to install requirement.txt so everything is up-to-date. you can also install using **--user** flag if you don't have admin permissions. – from_the_docs Aug 20 '20 at 12:23
0

python manage.py createsuperuser works on all platforms. I think it's because of your path. Type dir and press enter in your cmd (make sure you do it in your project directory) at let's see if there is a file called manage.py or not.

(test) C:\Users\SAHEB\projects\project>dir                                         
Carlos
  • 452
  • 2
  • 18
  • command successfully working in the windows environment but not working in Unix environment. – Urm Aug 20 '20 at 11:23