I have configured my python env with python 3.5, but I am getting the following error when I run my server with the command python manage.py runserver this is my config I tried reinstalling my env and changing python version but issue stills happening. Thanks for your questions guys Answer Hey looks like you are using the wrong django version,
Tag: django
How start celery worker in Django project
I have a Django project with the directory structure mentioned below. I am trying to use Celery for running tasks in the background. I have facing some trouble while running the worker. Whenever I issue the following command, I get an error. Command From the projectdirectory where manage.py resides ModuleNotFoundError: No module named ‘tasks’ From the projectdirectory where celery.py resides
Convert date object in normal format
When I am using a Python object, I get: This is not the format I need. We need to convert to this data format: How can I convert this in Python/Django? Example: It’s working fine, but how can I pass 2018-05-18 10:05:06 as database but database giving? It’s giving 2018-05-18 08:38:58+00:00. How can I check date as per 2018-05-18 08:38:58?
How to auto generate slug from my Album model in django 2.0.4
I have an Album field with a list of Songs I would like to know how to generate slugs from the album title. I am following a tutorial which is using django 1.8 which uses regular expressions to implement this task. But from looking through the documentation they have introduced a more simpler approach (”). So can you help explain
Django test error: Column does not exist
Postgresql, Django 2.0, Python 3.6.4 After running a migration that changed the name of a field desktop_pay to simply pay, I’m getting an error when running manage.py test saying the column pay does not exist. Here’s the migration: Here’s the error: If I start a psql prompt, though, I can clearly see that the column does exist, at least in
how to create a autocomplete input field in a form using Django
I am pretty new to django and its ways. I am trying to create an autocomplete field for a form. My code is as below forms.py What I want to achieve is that when an user types words into the “From Email” field the list of emails I have stored in an external DB should appear in the autocomplete list
How to pass choice display name to model serialize in Django REST framework?
My env is Django 2.0.3, DRF 3.8.2 and Python 3.6.4. I have a model in serializers.py: Where destination field is choice field of 3 elements: This is my models.py: ..And I return JSON like this: How to return destination field with his display name? For example: Would be great to have something like get_FOO_display() in serializers.py, but it’s not working.
How to list applied migrations from command line?
I had run makemigrations and after that migrate to apply the migration How to find out models in boards from command line? Answer You’ll need to use some undocumented APIs for this, but here’s one way: After this, loader.disk_migrations will be a dictionary whose keys are (app_name, migration_name) tuples, and whose values are the Migration objects. So iterating loader.disk_migrations.keys() will
Django 2.0 – Reverse for ‘password_change_done’ not found. ‘password_change_done’ is not a valid view function or pattern name
I’m having this error message after trying to change my app’s password. Do you have any idea of what’s causing this route to fail? Actually, it is changing the password but it isn’t rendering the success template “password_change_done.html”. Thanks! app/urls.py ERROR MESSAGE app/templates/registration/password_change_form.html app/templates/registration/password_change_done.html Thanks for your help! Answer I think the problem here is, as Tobit hints, is that
email authentification doesn’t work using django-allauth
I installed django-allauth and set it up to use it for the internet registration and authentication backend in order to have an email confirmation at registration and sign up the users using their email instead of their username. What is happening is that the registration works perfectly, the authentication using the email doesn’t work whereas it’s working with the username.