Re: Common problem finding static files. Help appreciated.

2021-08-18 Thread Scott Zimmerman
Resolved by changing nginx config file from above to this:
location /static {
root /home/www/wcsdg/main;
}

On Wednesday, August 18, 2021 at 8:03:00 AM UTC-5 Scott Zimmerman wrote:

>
>  I deployed django + nginx + gunicorn, and DEBUG = True. Nginx/error.log 
> shows that my problem finding static files is a concatenation mistake (caps 
> added)...
>
> "/home/www/wcsdg/main/STATIC/STATIC/main/styles.css" failed (2: No 
> such file or directory),
>  It should instead search for...
>
> "/home/www/wcsdg/main/static/main/styles.css"
>
> But there are 3 places where "static" is configured and I don't know what 
> I'm doing wrong:
>
> In settings.py...
>
> STATIC_URL = '/static/'
> STATIC_ROOT = '/home/www/wcsdg/main/static'
>
> In /etc/nginx/sites-available/wcsdg...
>
> location /static {
> root /home/www/wcsdg/main/static;
> }
>
> I also added whitenoise as an app in settings.py and restarted nginx and 
> gunicorn but it didn't help.
>
> Any advice?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0ced050a-9b98-42db-8d74-2c43491ecb82n%40googlegroups.com.


Python code changes are not reflecting on Django-based web server.

2021-08-18 Thread Hasan Baig
Hi,

I have been hosting a django-based web server (httpd with mod_wsgi package) on 
Linux CentOS 7. I used to reflect the changes made in my code by restarting the 
web server using the following commands:

sudo systemctl stop httpd
sudo systemctl start httpd

and it would reflect the changes smoothly. Since few days back, this strategy 
has not been work at all. That is, whenever I make any changes in my python 
code, even simply printing a message in log file, it is not reflected. To 
reflect the changes every time, I have to reboot the VM. I tried the following 
things already which did not help at all:

• Clearing .pyc files
• Restarting/Reloading httpd server
• touch wsgi file
• http is running without caching or proxying (modules have been commented out)


All of the above mentioned tries did not appear to work. The changes are only 
reflected once when the VM is rebooted. 

What do I need to do to make the code changes reflected without rebooting the 
VM every time? Any clues, help or suggestions are highly appreciated.

Thanks.

regards
HB

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9AB779C6-CE51-4410-9A27-0E8BBFAEA55B%40gmail.com.


View that displays my ManyToManyField('self'...) relations in a with levels

2021-08-18 Thread M. GW
Hi,

I am now trying, for days, to get a tree like view from my assembly model 
into my template. I think I have read everything what I have found on 
StackOverflow and other sites. Somehow I am not able to get it working. I 
am trying to not use any 3rd party extensions => I'm happy to be proven 
wrong. But first let me explain my topic:

This are my models:

class Assembly(models.Model):
reference = models.OneToOneField('products.Reference', 
on_delete=models.RESTRICT, verbose_name=_('reference'))
subassembly = models.ManyToManyField(SubAssembly, blank=True, 
verbose_name=_('subassembly'))
component = models.ManyToManyField(Component, blank=True, 
verbose_name=_('component'))

class SubAssembly(models.Model):
reference = models.CharField(max_length=40, default=None)
subassembly_class = models.ForeignKey(SubAssemblyClass, 
on_delete=models.CASCADE)
nested_subassembly = models.ManyToManyField(
'self', symmetrical=False, blank=True)

class SubAssemblyClass(models.Model):
name = models.CharField(max_length=255)

class Component(models.Model):
reference = models.CharField(max_length=40, unique=True)
component_class = models.ForeignKey(ComponentClass, 
on_delete=models.CASCADE)
nested_component = models.ManyToManyField('self', blank=True')

class ComponentClass(models.Model):
name = models.CharField(max_length=255, unique=True)


For my view I am using the class based one. I am generally using CBV's

class AssemblyDetailView(LoginRequiredMixin, DetailView):
model = Assembly
template_name = "engineering/assembly/assembly_detail.html"

Now I want in my template all children of subassembly and component from 
one assembly like this:

assembly1
* subassembly1
* subassembly5
* component5
* component7
* component8
* subassembly6
* component7
* component8
* component1
* component2
* subassembly2
* component3
* subassembly3
* subassembly6
* component1
* component2
* component1
* component3

The depth can be infinity but for now there will be only 3-5 levels. I 
don’t care if it will be Depth-first-search or Breadth-first-search. I read 
a lot about recursive common table expressions and raw queries. I haven’t 
found a way to code the logic with my complicated ManyToMany fields.

I hope there is someone out there who can help me out. Maybe I have build 
up the models in a wrong way and that’s causing the problems why I am not 
able to solve it or or something else.

Thank you for your help!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/95ef56a4-6fc5-4cdd-9d4a-9090e364a308n%40googlegroups.com.


Re: HELP me: "a beginner's questions"

2021-08-18 Thread M. GW

Hey,

have you check this:

https://docs.djangoproject.com/en/3.2/howto/deployment/
jt.vc...@gmail.com schrieb am Mittwoch, 18. August 2021 um 15:03:03 UTC+2:

> Hi
>
> I am now starting to work in Django.
>
> I built a development environment on my laptop. I experimented there, 
> things work.
>
> I have a web server on the net. With multiple hosted domains.
>
>  
>
> I would put my attempt on one. But things don't work.
>
> - python is installed, updated
>
> - I installed django
>
> - "python3 manage.py runserver" seems to work, but nothing comes out
>
>  
>
> Questions:
>
> - how do I transfer the developed file there?
>
> - what do I need to do to run as a web server?
>
>  
>
> Thanks for the help
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9d85813c-2aee-4dc4-9846-cff4511372f7n%40googlegroups.com.


Re: HELP me: "a beginner's questions"

2021-08-18 Thread Alex B
Hello,

There are a few ways to deploy a Django site to a production server. Tools
like Ansible and Docker help a lot.

One way to transfer files is via git push and pull through a repository.
There are other ways as well.

Once the files are on the server, the server needs all the services set up
and running for database, static files, http server, caching, environment
variables etc. There can be a lot more to this.

I had the same questions as yours about a year ago, and can empathize..
I've since learned a couple different reliable deployment methods using
Dokker/dokku and Ansible. Happy to help more if you'd like, hit me up here
or directly.

Alex B



On Wed, Aug 18, 2021, 7:02 AM  wrote:

> Hi
>
> I am now starting to work in Django.
>
> I built a development environment on my laptop. I experimented there,
> things work.
>
> I have a web server on the net. With multiple hosted domains.
>
>
>
> I would put my attempt on one. But things don't work.
>
> - python is installed, updated
>
> - I installed django
>
> - "python3 manage.py runserver" seems to work, but nothing comes out
>
>
>
> Questions:
>
> - how do I transfer the developed file there?
>
> - what do I need to do to run as a web server?
>
>
>
> Thanks for the help
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/001e01d7940e%24095cd210%241c167630%24%40gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALyOw5h%3D24yn9vv5DSs279he_rytJAoOZauirt8oX5tg8y--gQ%40mail.gmail.com.


Re: What is the difference bulk_update() and update() in django queryset.

2021-08-18 Thread M. GW

bulk_update() is a method that updates the provided list of objects into 
the database with one query.

and update() is just for one object

ambiti...@gmail.com schrieb am Donnerstag, 12. August 2021 um 00:03:25 
UTC+2:

> What is the difference bulk_update() and update() in django queryset.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/678c6d16-ebe7-4811-84c4-d9c194a80caen%40googlegroups.com.


HELP me: "a beginner's questions"

2021-08-18 Thread jt.vcomplex
Hi

I am now starting to work in Django.

I built a development environment on my laptop. I experimented there, things
work.

I have a web server on the net. With multiple hosted domains.

 

I would put my attempt on one. But things don't work.

- python is installed, updated

- I installed django

- "python3 manage.py runserver" seems to work, but nothing comes out

 

Questions:

- how do I transfer the developed file there?

- what do I need to do to run as a web server?

 

Thanks for the help

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/001e01d7940e%24095cd210%241c167630%24%40gmail.com.


Common problem finding static files. Help appreciated.

2021-08-18 Thread Scott Zimmerman

 I deployed django + nginx + gunicorn, and DEBUG = True. Nginx/error.log 
shows that my problem finding static files is a concatenation mistake (caps 
added)...

"/home/www/wcsdg/main/STATIC/STATIC/main/styles.css" failed (2: No such 
file or directory),
 It should instead search for...

"/home/www/wcsdg/main/static/main/styles.css"

But there are 3 places where "static" is configured and I don't know what 
I'm doing wrong:

In settings.py...

STATIC_URL = '/static/'
STATIC_ROOT = '/home/www/wcsdg/main/static'

In /etc/nginx/sites-available/wcsdg...

location /static {
root /home/www/wcsdg/main/static;
}

I also added whitenoise as an app in settings.py and restarted nginx and 
gunicorn but it didn't help.

Any advice?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ddca78e8-fa18-4fb5-ac7c-e809d4149c31n%40googlegroups.com.


Re: Role And Permission

2021-08-18 Thread Premkumar Chalmeti
I was working on a similar requirement.

Checkout this https://github.com/premchalmeti/company_uam

Inside `Docs/` I've attached a class diagram check if its useful. Lets 
collaborate together.

On Tuesday, August 17, 2021 at 12:00:42 PM UTC+5:30 amit.m...@gmail.com 
wrote:

> Handling Role From Frontend side 
> like:- 
> add role
> delete role
> update role 
> then Handling Permissions
> Assign permission
> remove permissions from frontend side
>
> So finally I want to Customise role and permission 
> any one guide me for this?
>   
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7aa1aafd-697d-4938-ac3e-082bc8a69403n%40googlegroups.com.


Re: scss

2021-08-18 Thread Saurabh Ranjan Singh
you can refer to django-sass-compiler library

On Wed, 18 Aug, 2021, 11:52 am Amit Vaghani,  wrote:

> How to use scss in our django project
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9a8d5442-a95e-4c27-9db2-ec635f942e6dn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB9KW5_Gna9DujHOLJ0tCrJZtmx0pBEFQ%3DROxedj4-JRs%2B-aWg%40mail.gmail.com.