Skip to content
Advertisement

Tag: django

“Database ‘docker-db’ does not exist”

so I have this problem building django/postgre app with docker. it keeps saying “database does not exist” and quite few time googling doesnt bring any results. I already scrapped the volumes and rebuilt my app few times, followed different guides on how people do the postgres, still no luck making it work for me. Dockerfile compose.yml .env UPDATE: Error messages

How to put object datefield in html input value

I have a class “client” with an attribute datefield called “birth_date”. I want to give the possibility for update this field. How can i put the default value in the form, in the input type date? Because the format in “client.birth_date” is different. If i try with, for example: The input value is setting true, but the format is different

Cannot access staticfiles using Pycharm Community Edition

UPDATE: I have updated the followin This is the html file for that specific webpage. Here is the CSS file: I have also changed the settings file like this: You can see my project tree as under for more clarification: Now there is no error but the background image that I am trying to get is now shown on that

‘SessionStore’ object has no attribute ‘cart’ – Django

I generated a basket with 2 products, at the level of the basket page and also on this same page I added a form to insert the customer’s name. by clicking on the submit button which will send the request to a view for insert into the database. but I have an error (‘SessionStore’ object has no attribute ‘cart’) I

django url error this problem is happening only when user is logged in

##error is with line 12 #log ” Traceback (most recent call last): File “/app/.heroku/python/lib/python3.10/site-packages/django/core/handlers/exception.py”, line 34, in inner response = get_response(request) File “/app/.heroku/python/lib/python3.10/site-packages/django/core/handlers/base.py”, line 115, in _get_response response = self.process_exception_by_middleware(e, request) File “/app/.heroku/python/lib/python3.10/site-packages/django/core/handlers/base.py”, line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File “/app/website/views.py”, line 298, in gallery return render ( request, ‘gallery.html’, context) File “/app/.heroku/python/lib/python3.10/site-packages/django/shortcuts.py”, line 19, in render

Automatic avoidance of category duplicates

I have the problem with Category Model. I have 2 tables: so they are standard models with categories. User can create Category by creating a movie with the name of category additionaly. The problem is when user is trying to create Movie with category name that already exists, because it will create another category with the same name (like duplicate)

Building a custom canonical url in python

I want to build a canonical url for my website: my.com here are the requirements: always include www subdomain always use https protocol remove default 80 and 443 ports remove trailing slash Example: This is what I have tried: But I don’t know how to join these url components? Answer You just need to write a simple function, Execution, Few

Error in running a project regarding virtual environment and “DJANGO_SECRET_KEY” in VS code

I want to run a project from gitlab on my local machine. I cloned the project, created a virtual environment and activated it. When I want to run without debugging I got this error: The output of this project is a form, how can I solve this error to get the output? Answer There’s a good explanation here https://stackoverflow.com/a/47117966/20027268 basically

Django NotEqual custom lookup on related field

I registered a custom lookup base on this answer and official documentation. I registered the custom lookup in my app config. Then i use it in the exclude method this way. The idea here is to get all the customers where user is info.context.user (with private is False or True) OR user is NOT info.context.user but private is False but

Advertisement