Connection refused by Unix socket file

2018-07-15 Thread need_some_help
Having some trouble linking up Django + uWSGI + NGINX

If I run the Django development server, the page works perfectly.

If I run with: uwsgi --http 0.0.0.0:8134 --wsgi-file 
/test/test_project/wsgi.py and access it at localhost:8134 the site works 
except the images are not being loaded.

But if I access the site at localhost:80 (presumably for nginx handling), I 
get an error in the nginx error.log (the following is for ONE page request, 
so not sure why it looks like two):

2018/07/15 11:55:34 [error] 20986#20986: *1 connect() to 
unix:/test/test_project/test.sock failed (111: Connection refused) while 
connecting to upstream, client: 127.0.0.1, server: 127.0.0.1, request: "GET 
/ HTTP/1.1", upstream: "uwsgi://unix:/test/test_project/test.sock:", host: 
"localhost"
2018/07/15 11:55:34 [error] 20986#20986: *1 connect() to 
unix:/test/test_project/test.sock failed (111: Connection refused) while 
connecting to upstream, client: 127.0.0.1, server: 127.0.0.1, request: "GET 
/favicon.ico HTTP/1.1", upstream: 
"uwsgi://unix:/test/test_project/test.sock:", host: "localhost", referrer: 
"http://localhost/;

I've made sure to run 'sudo service nginx reload' and 'sudo service nginx 
restart'.


Primary Question:
1. Why can I not access the site via localhost:80. I am guessing it has to 
do with the socket file refusing connections; the socket file is empty and 
was created with 'uwsgi --ini test_uwsgi.ini'. Is there something with 
inetd/xinetd I need to check?

Secondary Questions (may require a separate post):
1. Not sure if there is something wrong with the configuration or if I am 
running this correctly to begin with at all. Do I have to run 'sudo service 
nginx start' AND run 'uwsgi --http 0.0.0.0:8134 --wsgi-file 
/test/test_project/wsgi.py'? I'm guessing yes for now unless I somehow 
automate the uwsgi command through nginx.
2. Should every script, image and configuration file be owned by www-data?
3. Are my static images folder accessible by uwsgi and nginx (based on the 
configs below)? How to make sure?
4. I've had issues with cookies not being passed, so if there's something 
with the config preventing that, please let me know.


Here is the setup:

/test/test_project/test.sock permissions:

  srwxrwxrwx 1 www-data www-data 0 Jul 14 22:51 test.sock
  *Obviously I'll want to tighten this up, but for troubleshooting   
purposes permissions are open wide.


/test/test_project/test_uwsgi.ini:

  [uwsgi]

  chdir = /test/test_project
  module = test.wsgi

  pythonpath = /usr/bin/python2
  # process-related settings
  master = true
  processes = 8
  socket = /test/test_project/test.sock
  chmod-socket = 666
  max-requests = 5


/test/test_project/uwsgi.py:

  def application_backup(environ, start_response):
  start_response('200 OK', [('Content-Type', 'text/html')])
  return view.index(environ, start_response)


custom_nginx.conf:

  upstream django {
   server unix:/test/test_project/test.sock;
   # Also tried unix:///test/test_project/test.sock;
  }

  server {
   listen 80;
   server_name 127.0.0.1;
   charset utf-8;

  client_max_body_size 1024M;

  location /static {
   alias /test/test_project/static;
   }

  location /media {
   alias /test/test_project/media;
   }

  location / {
   uwsgi_pass django;
   include uwsgi_params;
   }

   access_log /var/log/nginx/access.log;
   error_log /var/log/nginx/error.log warn;
  }

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a8aa34a0-25a9-4361-b388-7db4f0cb8c7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django "pub_date" error

2018-07-15 Thread Dylan Reinhold
Without your code no one can help you (they will just be guessing). Post
your models.py and the exact traceback error.


On Sun, Jul 15, 2018 at 7:52 PM, Daniel Tobi Onipe <
dexterousgur...@gmail.com> wrote:

> I wrote it exactly as it is in the tutorial...
>
> On Mon, Jul 16, 2018, 02:56 afj afj  wrote:
>
>> probably if you would show us the code you've written it would be better.
>>
>> On Monday, July 16, 2018 at 2:37:31 AM UTC+3, Daniel Tobi Onipe wrote:
>>>
>>> Hi guys. My name is Daniel. I've been having issues with the "pub_date"
>>> part of the tutorial. It keeps popping up a traceback error saying
>>> "pub_date is an invalid keyword argument for this function"... What should
>>> I do? Thanks in advance
>>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/75a202b2-b883-406e-be29-07be8f6bace9%
>> 40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAE5gE5StD0e5X2BD8p%3DBw_fCzwyAk7YSGY_tw0VbV0g0wAqMGg%
> 40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHtg44AQ8q6KcSgYpgSsdO4_W6p0L%3DXeSe%2Bun26mStbQs2MinA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django "pub_date" error

2018-07-15 Thread Daniel Tobi Onipe
I wrote it exactly as it is in the tutorial...

On Mon, Jul 16, 2018, 02:56 afj afj  wrote:

> probably if you would show us the code you've written it would be better.
>
> On Monday, July 16, 2018 at 2:37:31 AM UTC+3, Daniel Tobi Onipe wrote:
>>
>> Hi guys. My name is Daniel. I've been having issues with the "pub_date"
>> part of the tutorial. It keeps popping up a traceback error saying
>> "pub_date is an invalid keyword argument for this function"... What should
>> I do? Thanks in advance
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/75a202b2-b883-406e-be29-07be8f6bace9%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE5gE5StD0e5X2BD8p%3DBw_fCzwyAk7YSGY_tw0VbV0g0wAqMGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django "pub_date" error

2018-07-15 Thread afj afj
probably it would be an error spelling the proper function.

On Monday, July 16, 2018 at 2:37:31 AM UTC+3, Daniel Tobi Onipe wrote:
>
> Hi guys. My name is Daniel. I've been having issues with the "pub_date" 
> part of the tutorial. It keeps popping up a traceback error saying 
> "pub_date is an invalid keyword argument for this function"... What should 
> I do? Thanks in advance
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8d29902a-d4ff-4fa8-803a-ebc59e41eab3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django "pub_date" error

2018-07-15 Thread afj afj
probably if you would show us the code you've written it would be better.

On Monday, July 16, 2018 at 2:37:31 AM UTC+3, Daniel Tobi Onipe wrote:
>
> Hi guys. My name is Daniel. I've been having issues with the "pub_date" 
> part of the tutorial. It keeps popping up a traceback error saying 
> "pub_date is an invalid keyword argument for this function"... What should 
> I do? Thanks in advance
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/75a202b2-b883-406e-be29-07be8f6bace9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin CSS Not Working in Opera or UC Browser

2018-07-15 Thread Gerald Brown
One thing I noticed in your settings file is that you are missing a 
comma (,) at the end of your last application in the settings file.



On Monday, 16 July, 2018 08:54 AM, Kayode Oladipo wrote:
I recently sent in a query concerning my faulty admin css which loaded 
previously until an upgrade to v.2.0.5.
I assumed the upgrade was responsible for this, so i downgraded back 
to my previous version (2.0.2) but there was no change. I have 
uninstalled and tried all fixes I know all to no avail.
The admin css is still not loading in the above mentioned browsers but 
is loading in Internet Explorer (which I do not want to use).


I would appreciate any assistance.
Attached is the settings file from my project.

Cheers from Nigeria.
--
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 post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BARzD_qF1treWg%2Bf4xz76S-DNRZ6%3DVTexBTTJBXTp4E%3DcVy5A%40mail.gmail.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/64b3b244-889c-8893-b2ab-0bdfbd5cd2df%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin CSS Not Working in Opera or UC Browser

2018-07-15 Thread Gerald Brown

Have you tried FireFox?


On Monday, 16 July, 2018 08:54 AM, Kayode Oladipo wrote:
I recently sent in a query concerning my faulty admin css which loaded 
previously until an upgrade to v.2.0.5.
I assumed the upgrade was responsible for this, so i downgraded back 
to my previous version (2.0.2) but there was no change. I have 
uninstalled and tried all fixes I know all to no avail.
The admin css is still not loading in the above mentioned browsers but 
is loading in Internet Explorer (which I do not want to use).


I would appreciate any assistance.
Attached is the settings file from my project.

Cheers from Nigeria.
--
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 post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BARzD_qF1treWg%2Bf4xz76S-DNRZ6%3DVTexBTTJBXTp4E%3DcVy5A%40mail.gmail.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/66706dcc-4827-6b46-fd3b-995839c8d09f%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Admin CSS Not Working in Opera or UC Browser

2018-07-15 Thread Kayode Oladipo
I recently sent in a query concerning my faulty admin css which loaded
previously until an upgrade to v.2.0.5.
I assumed the upgrade was responsible for this, so i downgraded back to my
previous version (2.0.2) but there was no change. I have uninstalled and
tried all fixes I know all to no avail.
The admin css is still not loading in the above mentioned browsers but is
loading in Internet Explorer (which I do not want to use).

I would appreciate any assistance.
Attached is the settings file from my project.

Cheers from Nigeria.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BARzD_qF1treWg%2Bf4xz76S-DNRZ6%3DVTexBTTJBXTp4E%3DcVy5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


settings.py
Description: Binary data


Re: Re: Beginner

2018-07-15 Thread Harsh Rawat
Options regarding new names ?
i didn't get it
I am really sorry for disturbing you again and again

*Harsh Rawat |  +91-8824348448*
*Marketing Associate, SPREE'18*
*Department of Sponsorship & Marketing*
*Birla Institute of Technology and Science, Pilani*
*K.K. Birla Goa Campus*

On Sat, Jul 14, 2018 at 9:35 PM,  wrote:

> [image: BitBounce]
>
>
>
> Hello! I use a new email filtering service called BitBounce to filter my
> email. To deliver your email to my inbox, please click the button below and
> pay the small cryptocurrency fee. Thank you!
>
> *$0.05* to deliver your email.
>
> We’ve never met — I’ll pay your fee.
> 
>
> I know you — Add me to your whitelist.
> 
>
>
>
> *BitBounce*  is powered by the
> *Credo*  cryptocurrency
>
> *I’m from a business* —  what are my *delivery options*
> 
>
> BitBounce and Credo are transacted through *CredoEx*
> 
> Made by Turing Technology Inc. in San Mateo, California *Sign Up for
> BitBounce* 
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/94a55d90d1df431f4024cdef80e0a1
> e6%40ip-172-31-22-54.us-west-1.compute.internal
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALd6sVMJgAUi9ET0V%3D2PFH3ZCCTFcTa7x73tD5jh91LzFD2yzA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: I can't see my models in MySQL db

2018-07-15 Thread A. Azimzadeh
Any help !?


On Sat, Jul 14, 2018, 15:23 ali reza  wrote:

> Hi all,
>
> I attached my Django project as a ZIP file.
> please help me to find and fix the root cause of issue.
> Link:
> https://ufile.io/ycmut
>
> Thanks in advance
>
> On Wednesday, 4 July 2018 17:50:49 UTC+4:30, ali reza wrote:
>>
>> Greetings!
>>
>> *Note:*
>> mysite is the name of project.
>> django_sb_admin and polls are my apps.
>> python version: 3.6.6
>>
>> I used *inspectdb* for creating *models.py* for *django_sb_admin*
>> application.
>> *pyhton3 manage.py inspectdb > models.py*
>> # Here inspectdb worked fine.
>> then is moved models.py into django_sb_admin app.
>>
>>
>>
>> *root@kali:~/PycharmProjects/django/azim_projs# ls*
>> db.sqlite3  django_sb_admin  manage.py   mysite  polls
>>
>>
>> =
>> *root@kali:~/PycharmProjects/django/azim_projs# cat
>> django_sb_admin/apps.py *
>> from django.apps import AppConfig
>>
>> class DjangoSbAdminConfig(AppConfig):
>> name = 'django_sb_admin'
>>
>>
>> =
>> *root@kali:~/PycharmProjects/django/azim_projs# cat mysite/settings.py *
>> <...skipped.>
>> <...skipped.>
>> <...skipped.>
>>
>> INSTALLED_APPS = [
>> 'django_sb_admin.apps.DjangoSbAdminConfig',
>> 'polls',
>> 'django.contrib.admin',
>> 'django.contrib.auth',
>> 'django.contrib.contenttypes',
>> 'django.contrib.sessions',
>> 'django.contrib.messages',
>> 'django.contrib.staticfiles',
>> ]
>>
>> <...skipped.>
>> <...skipped.>
>> <...skipped.>
>>
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.mysql',
>> 'OPTIONS': {
>> 'read_default_file':
>> '/root/PycharmProjects/django/azim_projs/mysite/mySQL.conf',
>> },
>>   }
>> }
>>
>>
>> =
>> *root@kali:~/PycharmProjects/django/azim_projs# cat mysite/mySQL.conf *
>> [client]
>> database = djangoDB
>> host = 127.0.0.1
>> user = root
>> password = "456789"
>>
>>
>> =
>>
>> =
>>
>> =
>>
>> =
>> *root@kali:~/PycharmProjects/django/azim_projs# python3 manage.py
>> makemigrations django_sb_admin*
>> No changes detected in app 'django_sb_admin'
>>
>>
>> =
>> *root@kali:~/PycharmProjects/django/azim_projs# python3 manage.py migrate
>> django_sb_admin*
>> Operations to perform:
>>   Apply all migrations: django_sb_admin
>> Running migrations:
>>   Applying django_sb_admin.0001_initial... OK
>>
>>
>> =
>> *root@kali:~/PycharmProjects/django/azim_projs# python3 manage.py migrate*
>> Operations to perform:
>>   Apply all migrations: admin, auth, contenttypes, django_sb_admin,
>> sessions
>> Running migrations:
>>   Applying contenttypes.0001_initial... OK
>>   Applying auth.0001_initial... OK
>>   Applying admin.0001_initial... OK
>>   Applying admin.0002_logentry_remove_auto_add... OK
>>   Applying contenttypes.0002_remove_content_type_name... OK
>>   Applying auth.0002_alter_permission_name_max_length... OK
>>   Applying auth.0003_alter_user_email_max_length... OK
>>   Applying auth.0004_alter_user_username_opts... OK
>>   Applying auth.0005_alter_user_last_login_null... OK
>>   Applying auth.0006_require_contenttypes_0002... OK
>>   Applying auth.0007_alter_validators_add_error_messages... OK
>>   Applying auth.0008_alter_user_username_max_length... OK
>>   Applying auth.0009_alter_user_last_name_max_length... OK
>>   Applying sessions.0001_initial... OK
>>
>>
>> =
>> *root@kali:~/PycharmProjects/django/azim_projs# python3 manage.py
>> sqlmigrate django_sb_admin 0001*
>> BEGIN;
>> --
>> -- Create model Appp
>> --
>> --
>> -- Create model ApTT
>> --
>> --
>> -- Create model CCnn
>> --
>> --
>> -- Create model CCtt
>> --
>> --
>> -- Create model Lact
>> --
>> -- Create model Lapt
>> --
>> --
>> -- Create model Laccte
>> --
>> --
>> -- Create model Urmng
>> --
>> COMMIT;
>>
>>
>> =
>> *Note:* see attached picture, I haven't my models as tables in *djangoDB*
>> database.
>>
>> What's the problem !?
>> Why I haven't tables in DB !??!
>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" 

Re: Including DetailView context in ListView page in the Order history page using Django

2018-07-15 Thread Samir Tendulkar
Thanks I realized I made a mistake there. I changed the models to from
Cjarfield  to

product = models.ForeignKey(Product, on_delete=models.CASCADE) Still
stuck on the view

On Sat, Jul 14, 2018 at 3:55 PM, Simon McConnell
 wrote:
> item.product.image from your template points to nothing. Product is a 
> CharField so I don't see it having any image attribute.
>
> Try to display some text for item.product or item.price and see how you go.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/092f9c42-3f1f-4cef-a7b4-9c6984013255%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN6Sv3hXzKiiwN8pY8NqO6YyF8ZUmi2oE7pNYLR9RvVqC2SD5g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django

2018-07-15 Thread Andréas Kühne
Like previously stated django isn't a CMS. Django is a framework to create
websites from scratch. That being said if you are familiar with Python and
want to use Python instead of PHP for creating a website you can also use
django-cms which is a plugin for doing what you want.

Regards,

Andréas

2018-07-15 5:38 GMT+02:00 Rohit Keshav :

> Django doesn't behave like WordPress. There isn't a UI like WordPress.
> For more refer -
> https://www.djangoproject.com/start/
>
> On Sat, Jul 14, 2018, 10:27 PM jiten amin  wrote:
>
>> Does Django provides UI interface like Wordprees do? How we can develop
>> website in django using UI?
>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/CAD%3Dev3Y3hWei0fug_eD%2BXpePd8BMhMStoimBSXaTOg2pRcia
>> Xg%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAOic_c%3DesUJpuEHSgi2%2B0uPDuE7Tbkga61ea4dvvyXHU_
> wQ6vQ%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCfsqO-DEmg1MZUKoemCLXf%2BOmAWUZo_4RG%2BzFYr5YwdHA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: App structure : "One file - One object" - Is there a better way ?

2018-07-15 Thread Bill Torcaso

I ask this out of genuine curiosity -- how do you edit source code?  I'm 
wondering because that seems inseparable from how you structure your python 
code into files.

I say this without any judgement.  If your brain likes one method per file, 
then you are asking your fingers and eyes to do more work than if you allow 
a complete class definition in one file.

Eclipse and PyCharm both allow you to collapse a method body, so that you 
see only its declaration line.  You can also collapse an entire class 
definition to its declaration, so that you can have multiple class 
declarations in one file and only see one at a time.  I wonder what you 
gain by your approach.

Looking forward to your reply,

  ---  Bill

(I myself mostly use "vi", with bash convenience functions for hopping 
around in the source tree.  I like PyCharm a lot, but it does not cover the 
remote execution scenarios that I need.)

>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ab6317bd-ec55-494f-9321-f209c03b8661%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Channels: long running async function and where to save ORM object

2018-07-15 Thread Sebastian Haase
Hi,
I'm still in the process of migration from channels 1 to channels 2...

One thing I'm interested in is related to [ 
http://channels.readthedocs.io/en/latest/one-to-two.html#application-instances 
]
"""ASGI applications are now instantiated once per socket and can use local 
variables on self to store information"""

So, we have an `AsyncJsonWebsocketConsumer` where websocket clients want to 
operate on a django model instance - each websocket mostly on the same 
object.
With channels 1 we would always send with each message the `objID` - doing 
`obj=model.objects.get(pk=objID)` and read/write on `obj`.
In channels 2 I could save the `objID` server side in the consumer class - 
like `self.objID` with one initial message like `set-obj-id`.
For the ORM access I now have to do `obj = await database_sync_to_async( 
model.objects.get )(pk=self.objID)` 

QUESTION: Is is legitimate to store the "model instance itself" like 
`self.obj = await database_sync_to_async( model.objects.get )(pk=objID)` 
and keep that instance around for the lifetime of that socket -- doing some 
`await database_sync_to_async( self.obj.save )()` on some respective  
messages ?
Note:  multiple websockets might operate on the same obj/objID ! So my 
feeling is that  would work as long as I keep testing with the `runserver` 
or in production as long as I know that I have only ONE PROCESS -- but in 
general the django caching mechanism might cause inconsistencies ... !?


Another, somewhat related question is regarding a kind of "background 
routine"  that I started to implement as an asyncio Task.  
Note:  It was kind of tricky to realize that I needed 
`asyncio.ensure_future` to get it run asynchronously -- 
ref. 
https://stackoverflow.com/questions/48871831/django-channels-async-consumer-does-not-appear-to-execute-asynchronously
Maybe that could be worked into the channels docs maybe 
here: http://channels.readthedocs.io/en/latest/topics/worker.html
Since that "routine" should be able to be canceled and pauses (I'm using an 
asyncio.event) from any websocket consumer:
QUESTION: What is the  best place to store that Task object ?  Again with 
`runserver` I can just use a global module-level `dict` to keep those Task 
objects.

The whole async experience is really twisting my mind  and interesting at 
the same time ;-)
Regards,
Sebastian


-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/123c14e2-65c6-499e-9a27-b3a256aab099%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [django-channels client wrapper] specifying no reconnection attempts

2018-07-15 Thread Andrew Godwin
I don't know much about that JavaScript code, I'm afraid, otherwise I would
try and help (it's likely we're going to deprecate support for it soon as
there's no maintainer for it right now anyway).

Take a look through the source code and see if there's something you can
call to stop reconnection attempts when you get a good close event, maybe?

Andrew

On Sat, Jul 14, 2018 at 5:31 AM bit bouncer  wrote:

> Basically, I don't want the websocket to automatically attempt
> reconnections after it has been closed by the server.
>
> I've tried
> new WebSocketBridge({maxReconnectAttempts: 1})
>
> and
> const socket = new WebSocketBridge({maxReconnectAttempts: 1})
>
> socket.connect('/ws/', undefined, {maxReconnectAttempts: 1})
>
> but to no avail.
>
> Am I doing something wrong? Any help would be appreciated.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e4471747-3133-49b7-b98d-cf7ecb64c1db%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFwN1uqdcj1fJ%2B9DUDXtgZ12%3D_RdCwFFBmCTgbGTMSvdjjNhxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.