Skip to content

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 ModuleNotF…

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 dat…

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 (&#8221…

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 cl…

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…