Debugging a project in PyCharm
📁 Conditions, Advanced Python Topics, Error, example, django, AI, debug, work, project
My task is to run a Django project under the debugger in PyCharm.
Conditions.
- Ubuntu 13.04, python 2.7
- I run the IDE as my user (e.g., nick).
- To access the database, the Postgres user www-data is used.
- When requesting a page, the script runs as the www-data user, then makes a request to the database.
To make everything work, I run the application using the following command:
sudo -u www-data python manage.py runserver test_domain.ru:8000After looking at PyCharm settings, I did not find an option to specify which user should run the script. As a result, an error occurs (since PyCharm is running as the user
Nothing. Actually, you're doing everything right. I got caught by this myself when I was implementing autocomplete in search via Haystack. Whoosh is just a "full-text" search with minimal morphology. For searching occurrences, you need to use the classic LIKE.
UPDATE I confess, I misled you. I decided to Google it after all, so as not to lose face. And here's what I found. Haystack has a special autocomplete method exactly for this.
import datetimefrom haystack import indexesfrom myapp.models import Noteclass NoteIndex(indexes.SearchIndex, indexes.Indexable): text = Log in to leave an answer
Blogs