Nefer
Have you wrote your code?
I'm learning django now but I needed a website for my application update and data extraction
运维
when you finish your project, it should be deployed on your server
Nefer
when you finish your project, it should be deployed on your server
I want to write "hello world" on my website and publish it. I want to extract data from my site in the desktop application I developed, in addition, I will upload a file for the update.
Nefer
Hello world is just an example
Ædel
try heroku
Ædel
and sop writing in monospace it's hard to read. unless its code
Ædel
then try gunicorn
Nefer
I understand. Iwill do what you say
FS-dev
Hi. everyone.
FS-dev
I am gonna service statics files(images and icons) with using restful api to React frontend. Who can help me for this problem?
FS-dev
Frontend is React.
FS-dev
Please ignore the restful api now, Let me know how to service the static files on django
Med
SALEOR :: can i create composite product with other products using saleor
Shery
FS-dev
I checked the doc already.
FS-dev
I am developing on windows debug mode.
FS-dev
Btw I can't get the images on statics folder.
Ali
I checked the doc already.
If you're trying to serve static files only not media files in production, check a library called django whitenoise
Jerome
django.db.utils.IntegrityError: NOT NULL constraint failed: manager_profile.user_id how can i fix this error
you probably trying to save something with a None value hence the error "not null constraint failed" hard to help without code
FS-dev
django & react with nginx is a way to go
sure. i used the nginx and gunicorn for django.
Jerome
sure. i used the nginx and gunicorn for django.
So you just have to define the path to a static folder hosted on nginx in your django app.
Jerome
then "manage py collectstatic"
FS-dev
I didn't install collectstatic yet.
FS-dev
Jerome
Can you inform the guide?
https://docs.djangoproject.com/en/4.1/howto/static-files/deployment/
Anonymous
any one can help me with how to extract month and year from date input form and fetch month and year wise data from database, for example html date form pass string like this 2022-10-18 extract year and month from this which will look like this 2022-10 then pass this extract date to database and fetch data ?
👑 Dharmzeey
Can you inform the guide?
Check the docs on how to configure the static files and if you are deploying on platform like heroku Make sure you install white noise and configure the middleware and then run manage.py collectstatic
👑 Dharmzeey
any one can help me with how to extract month and year from date input form and fetch month and year wise data from database, for example html date form pass string like this 2022-10-18 extract year and month from this which will look like this 2022-10 then pass this extract date to database and fetch data ?
What I do is that in my views.py I will split the string with .split("-") and indexing to get the 0th and 1st item of the returned value That's the year and month, then you can use it for what you want
WOLFxASSASSIN
Css and js files not working after deploying the project to Heroku Installed white noise , added in installed apps and middleware
WOLFxASSASSIN
do you run collectstatic
While deploying to Heroku it will automatically do that right? Actually i am somewhat new to this
WOLFxASSASSIN
python manage.py collectstatic --noinput?🤔
Anonymous
how to declare variable inside templates?
Maxim
how to declare variable inside templates?
don't declare variables inside templates
WOLFxASSASSIN
Heast
Hey guys somebody help me, My problem is i want to check a date in django model, in my model there is a from and to date field is there, and i want to check a date in between from and to date in model, now iam use "gte" and "lte" combination but it is not work for me... How can I do thes task..?
Artyom
Hello, I have some issue with testing my views. Here is a link. http://linkode.org/#XKdfnIkifvWjT3PTeF6XL7 def test_url_exists_at_correct_location returns 400 instead of 200 :( What I'm doing wrong?
Anonymous
is it possible to use one for loop inside another for loop in template?
Anonymous
possible
i used it but it print the value twice instead of once
Anonymous
here i am trying to fetch all employees data from payrolls and at the end trying to fetch if the user is in salarypayment if yes then status = 1 else status = 0, although its working but printing the status twoice
Anonymous
can you show your code
https://nekobin.com/fohohezepu
Anonymous
those employees which already paid for this month there status shows 1 0 and those who are not yet paid show status 0 when they get paid their status become 1 0
licensed
auto_launch = models.BooleanField(null=True, blank=True, default=True, help_text=_help["auto_launch"]) I have this model field, but it's appearing "Unknown/Yes/No" option on admin. Why? I don't want "Unknown" option. How can i take off this Unknown option from selectbox?
Aslan
Hello, is there way to import data from excel file to several models? I'm using django-import-export but it's only imports to one model
Jerome
Also don't change that on the fly coz you may have an error after migration because of null param, easiest is to delete the field, migrate, then recreate that field
Jerome
ok.. c.i. is failing if i didn't put this ;( but i will try. thanks
Have you an object with 'unique' & 'blank' set to True in that model? If yes, then you need to null objects to avoid constraints
licensed
Have you an object with 'unique' & 'blank' set to True in that model? If yes, then you need to null objects to avoid constraints
my database is empty.. if i go to django admin model and try to Add a new one, i have 3 options on BooleanField and i dont wanna have Unknown option selectable
licensed
Do u wanna display that options?
yes, i wanna display. but just Yes or No options. not UNKNOWN
Pythonero
BooleanField must not have null values.
licensed
You don't need blank & null param in that boolean, only default true or false, then result will be yes or no
you are correct. the option null=True give me third "Unknown" option. if i don't use this, the field is checkbox, instead selectbox.
Pythonero
not working
Share your code on pastebin or similar.
Mirco
not working
You have to use strptime , not strftime To convert back in a datetime
Anonymous
Share your code on pastebin or similar.
anyhow i solved this problem but the new problem is little confusing
Mirco
anyhow i solved this problem but the new problem is little confusing
We don't have magic ball, if explain we help otherwise we continue our lives 😊