I have been using django commands in my virtual environment for a longtime....
suddenly today
When i run this command in my cmd from my Anaconda Env.....
django manage.py runserver
cmd responded with this
'django' is not recognized as an internal or external command,
operable program or batch file.
when i ran the command "conda list" it shows django package in the list...
do anyone know a solution to this??
You should run it with python
python manage.py runserver
And make sure you have Django installed properly, and keep in mind you won't use anaconda for Django. Plus, if you're starting a project, the proper command will be
django-admin startproject project_name
Call Django with django-admin. Not exactly intuitive, but this is how Django works.
Related
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
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
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
I'm trying to run a Django (version 2.1) project in PyCharm, and the run configurations are properly set to work with the right environment and to use the manage.py file to run the server. At least with other projects in PyCharm I can run without problems. But why I only get the following error
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured
only when running directly from PyCharm? By command line it runs perfectly fine with the command 'python manage.py runserver'.
On my Windows 10 machine, I am developing a database manager. Because the backend uses LDAP and the required development libraries are only available for Linux, I want to use Docker to set up an environment with the appropriate libs.
I managed to write a Dockerfile and compose file, that launch the (currently very basic) Django app in a Docker container with all the libs necessary.
I would like to play around with the django-ldapdb package and for that I want to apply the migrations.
When I open PyCharm's terminal and try to execute python manage.py migrate, I get an error telling me that the module ldapdb is not found. I suspect this is because the command does not use the remote Docker interpreter I set up with PyCharm.
The other thing I tried is using PyCharm's dedicated manage.py console. This does not initialize properly. It says the working directory is invalid and needs to be an absolute path, although the path it shows it the absolute path to the project.
I have to admit that I have no idea how this remote interpreter works and I don't see any Docker container running, so I might have not understood something properly here. I even tried running the app using PyCharm's Django run config, which started a container, but still I get the same errors.
I googled a lot, but I couldn't find more infos about remote interpreters nor something solving my issue.
The only way I managed to do this, is by executing the command inside the container.
To get inside a container named contr, use the docker command
docker exec -ti contr /bin/bash
I installed Anaconda with Python, added some more packages and tried to run Django development python manage.py runserver 0.0.0.0. It's running fine but I can't access it remotely from some reason. My server on other port is working fine and firewalls are all set. I found others had this problem and they simply run it as superuser sudo python manage.py runserver 0.0.0.0.
My problem is that when running as superuser, it will use different Python (or at least that's what it looks like). It is same 2.7.12 version (but no Anaconda suffix) and there are no required packages, so I can't run server.
I'm not really experienced with Linux. I tried to remove Python from root and passing env variables, but that didn't help. How can I run python as superuser and use Python with packages from my user.
Try sudo running your local python, like
sudo /home/YourAnaconda_bin/python manage.py runserver 0.0.0.0
I am reading this tutorial: Installing and Configuring Graphite and Statsd on an Ubuntu 12.04 VPS
and I am working to automatize everything is possible then there is one step of this tutorial that is giving me crazy:
Next, we will configure the Graphite database. Go to the Graphite
webapp directory and run the database script:
cd /opt/graphite/webapp/graphite/
sudo python manage.py syncdb
As you see, we have to run the manage.py and when I run syncdb ask about a creation of superuser. How can I avoid that? I would like to run these sending all parameters to make an automatic script.
Any ideas?
You can use the --noinput argument to disable those prompts for the syncdb command.
--noinput
Use the --noinput option to suppress all user prompting, such as “Are you sure?” confirmation messages. This is useful if django-admin.py is being executed as an unattended, automated script.