Д
now do the migrate and see if it applies the migration
Lambda
[root@227245 nature]# python manage.py makemigrations nature.wsgi.application File "manage.py", line 14 ) from exc ^ SyntaxError: invalid syntax [root@227245 nature]# nano manage.py [root@227245 nature]# python manage.py makemigrations Core File "manage.py", line 14 ) from exc ^ SyntaxError: invalid syntax [root@227245 nature]# python manage.py makemigrations CoreConfig File "manage.py", line 14 ) from exc ^ SyntaxError: invalid syntax
Д
what
Lambda
cat manage.py #!/usr/bin/env python import os import sys if __name__ == '__main__': os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'nature.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv)
Д
this has to be a python version error?
Д
wait what
Д
sigh okay bro. you're on your own
Lambda
python --version Python 2.7.15 maybe try python3?
Д
I'm not gonna debug your deployment
Lambda
I'm not gonna debug your deployment
just say. need newest python version?
Д
just say. need newest python version?
I don't know. my manage.py doesn't have that weird "from exc"
Д
I'm wondering whether you typed or whether that's some syntax I don't know
Lambda
I'm wondering whether you typed or whether that's some syntax I don't know
second. python3 corrent run it and output error message: ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
Lambda
PYTHONPATH is ""
Yaquier
Are u using a IDE in particular?
Д
he doesn't know how python works apparently
Д
because he can't understand the error message - which is clear as day
Lambda
I understand everything, need to deploy a virtual environment
Lambda
ok
Yaquier
Well this error is because you aren't using the correct python interpreter by executing the project
Д
or the dependencies aren't properly setup in general — even if it was the "correct" interpreter
Yaquier
I understand everything, need to deploy a virtual environment
You need to launch the virtual environment first
Yaquier
You can't using Django if the interpreter you are using haven't the correct dependencies
Yaquier
Got it?
Д
let's say he installs a virtual environment. then he starts installing the packages by hand one by hand
Yaquier
This might be a way to do it
Д
it's not the way to do it.
Д
that's my prediction of what he's gonna do
Yaquier
But the correct and easier way is just install Django
Lambda
let's say he installs a virtual environment. then he starts installing the packages by hand one by hand
this project contain venv directory and manual about use is. I'll try it myself for now
Yaquier
But the correct and easier way is just install Django
This will install all the necessary dependencies
Д
this project contain venv directory and manual about use is. I'll try it myself for now
well I'm glad you're not using the venv that came with the project that has all the correct dependencies...
Yaquier
The path venv/Scripts/activate
Must launch the env on the shell
Lambda
thank you all for your help. I'll try and write a little later, now I need to rest
Yaquier
Mani
Hi for object in queryset.filter(created_date__day=15): if object.created_date.day == 14: print(object.created_date.day) when i do this query, I get lots of object which date is 14th, but I only query for 15th. why this happens?
Mani
can u show the code
Yes, that is my code. The query I make, it prints lots of objets with date of 14th, beside 15. But i only want 15th
Mani
I don't grasp why you use the filter and inside this put a if statement
I want to filter created date, date time object, that is on 15th of the month so, when I run the if statement, it shouldn't print anything, because objects should have all != 14 as created_date__day, but it prints many objects.
Mani
Well that's bcz of timezones if I'm not wrong
but i didn't change timezone or anything at all, I'm using same timezone since this project existed ever.
Mani
Can u show me your model?
This is the query SELECT "core_factors"."id", "core_factors"."user_id", "core_factors"."code", "core_factors"."tarikh", "core_factors"."fake_amount", "core_factors"."amount", "core_factors"."price", "core_factors"."total_price", "core_factors"."bonus", "core_factors"."bonus_percentage", "core_factors"."created_date", "core_factors"."paid" FROM "core_factors" WHERE EXTRACT('day' FROM "core_factors"."created_date" AT TIME ZONE 'Asia/Tehran') = 15
Mani
can you show model, and this filter used file fully?
The model has many fields, I think it's not relevant to the problem. As you can see the query made by ORM "core_factors" WHERE EXTRACT('day' FROM "core_factors"."created_date" AT TIME ZONE 'Asia/Tehran') = 15 I don't understand how it gets 14
Д
It's a type error combined with missing timezone data
Doragonsureiyā
Rule 5️⃣: To share code or error tracebacks, use an online pasting service like: - https://dpaste.org - https://linkode.org - https://hastebin.com - https://bin.kv2.dev If you posted a wall of text, go back and delete it.
Doragonsureiyā
Read this please: http://catb.org/~esr/faqs/smart-questions.html#intro
Anil
Hi does anyone provide me code or good tutorial for multiple user type should use same login screen and username login using django. E.g. on website one user or id can be existed under customer and supplier
Anil
Use Middleware
Bro can you provide me any link or reference. But thanks for the clue 🙂
Vitalik🐧
Thank you bro
U r welcome
Vitalik🐧
Give me a heart 😘
Vaibhav
so how can I fix this?
If you goal is to get the rows which were stored at 15th according to your time zone, it is giving the right result.. you don't have to worry about it
😒😒
{% for x in range(0, vitem.count()) %} {%t=ItemVariation.objects.all().filter(vname_id=vitemobj.values('id')[x][' id'])%} {% for y in range(0, t.count()) %} {% data = ItemVariation.objects.get(id=t.values('id')[y]['id']) %} {% endfor %} {% endfor %} Trying to write a for loop in my template but I get this error 'for' statements should use the format 'for x in y': for x in range(0, vitem.count())
😒😒
It literally tells what you need to do
I've done that but django doesn't allow writing statements inside templates
😒😒
{% data = ItemVariation.objects.get(id=t.values('id')[y]['id']) %} I'm trying to write this statement in my template, I'll have done this in my view.py and passed as context variable but the view.py won't recognise *y* variable
Abdullah
Hello is there anyone know build invoice seytam with django? I want help
😒😒
Why don't you send it from view
It's what I'm doing now I moved the whole loop into the view then I'm appending the data to a list to pass into my template
😒😒
So what's the issue with that
I was trying to write the whole statement in the template before but I've corrected that