I am developing an App Engine project on Windows using Eclipse and Python 2.5 and Django 0.96. Everything in my app, including Django, is working nicely.
My problems arise when I try to use command line. For example, I'm told that if I want to clear the local datastore I can enter "python manage.py reset" but when I do so the response is "python: can't open file 'manage.py'".
I feel as if I have missed a configuration step. I have checked my system variables and "Path" includes "C:\Python25" (which I had added manually) but nothing Django or App Engine related. My .py extension is associated with C:\Python25\python.exe.
In my quest to solve this, and in trying to understand what manage.py is, I see that I might have had to create a Django project using "django-admin.py startproject [myproject]" but because everything works nicely from Eclipse I'm not sure if this is necessary now. In any case, if I try to enter this from the command line I get "'django-admin.py' is not recognized..."
Please, what am I missing?
If you're using Django 0.96 templates within a 'normal' App Engine app, then manage.py isn't involved at all.
/path/to/dev_appserver.py --clear_datastore .
is what you want, assuming you're CD'd to the root of your app.
Related
Whenever I run my python django application in Intellij, it shows me a dialog box saying configuration is incorrect and gives me an option to edit or run anyway.
Following is the screenshot of my configuration. Not sure what is it that I am missing.
Update: It does show intermittently in the same configuration dialog box that Django project root is not configured and I am not sure how I can do that. Also, when I run the project anyway, it says,
No manage.py file specified in Settings->Django Support
I am not sure how is the above issue fixable directly but after pressing run on manage.py to create a new configuration and providing it script parameters runserver 127.0.0.1:8000, it worked without errors.
In the above older configuration, Intellij was running a different command
python3.5 /Users/myuser/.virtualenvs/myorg/bin/django-admin.py runserver 8000
I've had to clone a repository involving a django project.
This is my first time using django and the project is configured a bit differently than what a normal django project would be. For instance it has a settings folder with a local.py file that contains a Local(Dev) class. I have installed behave_django, however when I run the command 'manage.py behave' it says that the command is not recognised.
Therefore I believe that whilst I have added INSTALLED_APPS = ('behave_django',) to the local.py file it is not getting recognised. I have tried adding it outside the class and within. Is there a way I can run a script to check my list of installed_apps, etc. Also I am new to python and the configuration side has gotten me a bit confused.
You need to provide the --settings option so Django knows you wish to use a different settings file with your task
manage.py behave --settings=myapp.local
My app is pretty slow even in a dev environment so I would like to figure out what's slowing it down so I can try and fix it.
I know about the debug toolbar and according to what it reports neither the database queries nor the downloaded sources are the issue, so it must be the business logic.
However, I cannot run the PyCharm profiler with the Django server because, well, it's not like running a script.
How may I profile Django with PyCharm?
You should probably set configuration properly.
Then click on Edit Configurations...
The main thing is to set Interpreter (your virtual environment). You don't have to set Custom Run Command if you use python manage.py runserver
Then you can run Django server directly from PyCharm ann Profiler too.
I recently fromated my computer and installed win 10.
I have installed pycharm and python 3.4 with django 1.8.6 .
Then I loaded a django project, which I had on my computer before formatting it and backed it up on Google Drive.
I can run my app through command line with the command "python manage.py runserver" (I am running this command while I'm in the project path), and it's working very well like that.
But I need to run it through pycharm in order to use the debugger.
I've tried to use the "Edit configuration" button, but with no success.
Any help will be appreciated.
I have attached an image.
Edit configuration window:
I had to add a new configuration and not to edit the existing one.
I followed the steps from this post:
How to setup Django project in PyCharm
recently I started a small Django project that I developed on a local machine using a SQLite3 database and the integrated development server. I now copied the whole project to a server running Debian.
Everything worked well as long as I kept using the SQLite3 database. Now I wanted to switch to a local MySQL database, so I changed the settings.py file in my project's root folder, created the database and added a user. I then ran syncdb and it created the needed tables without any problems.
Now I wanted to use the app, but I keep getting errors, because Django can not find the tables - neither the 'standard tables' like django_sessions nor my own tables - even though they are there (I checked the database).
The one thing that seems awkward about the DatabaseError pages I get is the following line:
Exception Location: /usr/local/lib/python2.6/dist-packages/django/db/backends/sqlite3/base.py in execute, line 234
It seems like Django is still using the SQLite3 backend even though I set it to use the MySQL backend.
The other thing that nearly makes me freak out is this: I deleted the data.sqlite file in my app's root folder using rm. But when I use my app, the file is being recreated!
Can anyone tell me where I went wrong?
When running in production with mod_wsgi or mod_python, new code isn't incorporated until you reload/restart the webserver.
If you are using apache with mod_wsgi, you can also touch the wsgi.py file to restart the python code only.
If running on apache run "sudo /etc/init.d/apache2 reload" everytime you make a change.