Re: Scrapy

2017-12-13 Thread Vineet Kothari
refer through tuitorialspoint

On Thu, Dec 14, 2017 at 10:35 AM, Rafael Mauricio Builes Marin <
bui...@utp.edu.co> wrote:

> Hi, somebody know something about scrapy I need help.
>
>
> El contenido de este mensaje y sus anexos son únicamente para el uso del
> destinatario y pueden contener información  clasificada o reservada. Si
> usted no es el destinatario intencional, absténgase de cualquier uso,
> difusión, distribución o copia de esta comunicación.
>
> --
> 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/571f4aba-f57a-4236-9900-3a5cc01d6600%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/CAAcanstU%2BhjxSLc%3DZEJtyGh4r3mQ4UGK8dKoTN-ffe20_cW0Jw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django field model for HTML parser?

2017-12-13 Thread Mike Dewhirst

On 14/12/2017 4:00 PM, drone4four wrote:

Hi fellow Djangoistas:

I'm back.

Thank you Atonis for your help.  I suppose I can leave the WYSIWYG 
editor static files for later when I have alittle more experience.  
For now though: how can I enable HTML markup to parse like it should?  
The box where users on my Django website make a blog post, they can 
attach images, apply a timestamp but the content is just plain text.  
How do I make it so that when I user for example enters this:


|
Lorem Ipsum
Hello and welcome to my first blog post
|

...that it posts and parses not as plain text but with the heading 
showing with a slightly larger font size than the rest and the first 
sentence is bolded?


That is easy but dangerous. You need to permit only a subset of markup. 
In your views you need to bleach [1] the user entered data then 
mark_safe() it. Bleach has a default set of html tags probably including 
 and  but you can add others. For all other tags it will 
convert angle brackets into > and < thus disabling them. Django's 
mark_safe will deliver any real tags to the browser.


[1] https://pypi.python.org/pypi/bleach





Thanks again.

-Drone4four

On Sunday, November 19, 2017 at 5:31:37 AM UTC-5, Antonis Christofides 
wrote:


Hello,

First of all: If you are just starting to learn, and because the
amount you have to learn can be overwhelming, I'd suggest to not
care about the wysiwyg editor at this stage. Pretend that your
users can enter HTML in the field, and do all the rest. After you
get some understanding of static files, only then come back to
this issue.

But to (prematurely) answer your question, if you have DEBUG=True
and running django with manage.py runserver, you shouldn't need to
care about STATIC_ROOT and STATIC_URL and collectstatic. Just
forget about them. When the time comes to deploy your application
and turn DEBUG off, then you will need to understand how static
files work in production

.

Regards,

Antonis

Antonis Christofides
http://djangodeployment.com


On 2017-11-19 01:38, drone4four wrote:


The official Django docs specify that STATIC_ROOT is indicated in
settings.py at the STATIC_URL variable (which is near the
bottom).  The official Django docs says:

Configure your web server to serve the files in STATIC_ROOT

under
the URL STATIC_URL

.


(link
)


I’m not running Apache. My Django serving is running locally. The
absolute path in my file tree to my Django root directory is:


/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/dobbs_portal_blog/

Inside dobbs_portal_blog is where I placed the static folder.
Therefore, the line in my settings.py where I declare the
variable, I changed from the default:

|
*STATIC_URL ='/static/'*
|

to:

*|
STATIC_URL

='/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/dobbs_portal_blog/static/'
|*

That is my best guess at attempting resolve the “pretty obvious”
error message:

You're using the staticfiles app without having set the
STATIC_ROOT setting to a filesystem path.


Yet I am still doing something wrong because invoking python3
dobbs_portal_blog/manage.py collectstatic, I still get the same
message:


$ python3 dobbs_portal_blog/manage.py collectstatic
You have requested to collect static files at the destination
location as specified in your settings.
This will overwrite existing files! Are you sure you want to
do this?
Type 'yes' to continue, or 'no' to cancel: yes Traceback
(most recent call last):  File "dobbs_portal_blog/manage.py",
line 22, in     execute_from_command_line(sys.argv)
 File

"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/__init__.py",
line 364, in execute_from_command_line    utility.execute()
 File

"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/__init__.py",
line 356, in execute
   self.fetch_command(subcommand).run_from_argv(self.argv)
 File

"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/base.py",
line 283, in run_from_argv    self.execute(*args,
**cmd_options)  File

"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick

Scrapy

2017-12-13 Thread Rafael Mauricio Builes Marin
Hi, somebody know something about scrapy I need help.


-- 
El contenido de este mensaje y sus anexos son únicamente para el uso del 
destinatario y pueden contener información  clasificada o reservada. Si 
usted no es el destinatario intencional, absténgase de cualquier uso, 
difusión, distribución o copia de esta comunicación.

-- 
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/571f4aba-f57a-4236-9900-3a5cc01d6600%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django on windows 10 and tomcat

2017-12-13 Thread Jani Tiainen
Hi.

Django is Pyhton webframework so deploying to Tomcat which is Java webapp
runner mighy not work at all.

14.12.2017 0.31 "Arnap"  kirjoitti:

> Am new to django and developing champion windows to be deployed in to cat,
> but getting error while deploying .war in tomcat6. Error is:
> cannot load 'application's, no module named mysite
> Where mysite is my application name, kindly help me
>
> --
> 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/f22e321a-f4b9-4e1c-a632-e48c0e2d097f%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/CAHn91od6J3Tf95sM8i8SRLJ6Uq7oghoviBVUwEbt4gFx8Th4Cw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django field model for HTML parser?

2017-12-13 Thread drone4four
Hi fellow Djangoistas: 

I'm back.  

Thank you Atonis for your help.  I suppose I can leave the WYSIWYG editor 
static files for later when I have alittle more experience.  For now 
though: how can I enable HTML markup to parse like it should?  The box 
where users on my Django website make a blog post, they can attach images, 
apply a timestamp but the content is just plain text.  How do I make it so 
that when I user for example enters this:

Lorem Ipsum
Hello and welcome to my first blog post

...that it posts and parses not as plain text but with the heading showing 
with a slightly larger font size than the rest and the first sentence is 
bolded?

Thanks again.

-Drone4four  

On Sunday, November 19, 2017 at 5:31:37 AM UTC-5, Antonis Christofides 
wrote:
>
> Hello,
>
> First of all: If you are just starting to learn, and because the amount 
> you have to learn can be overwhelming, I'd suggest to not care about the 
> wysiwyg editor at this stage. Pretend that your users can enter HTML in the 
> field, and do all the rest. After you get some understanding of static 
> files, only then come back to this issue.
>
> But to (prematurely) answer your question, if you have DEBUG=True and 
> running django with manage.py runserver, you shouldn't need to care about 
> STATIC_ROOT and STATIC_URL and collectstatic. Just forget about them. When 
> the time comes to deploy your application and turn DEBUG off, then you will 
> need to understand how static files work in production 
> 
> .
>
> Regards,
>
> Antonis
>
> Antonis Christofideshttp://djangodeployment.com
>
>
> On 2017-11-19 01:38, drone4four wrote:
>
> The official Django docs specify that STATIC_ROOT is indicated in 
> settings.py at the STATIC_URL variable (which is near the bottom).  The 
> official Django docs says:
>
> Configure your web server to serve the files in STATIC_ROOT 
>> 
>>  
>> under the URL STATIC_URL 
>> .
>>  
>>  
>
> (link 
> )
>
> I’m not running Apache. My Django serving is running locally. The absolute 
> path in my file tree to my Django root directory is:
>
>
> /home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/dobbs_portal_blog/
>
> Inside dobbs_portal_blog is where I placed the static folder. Therefore, 
> the line in my settings.py where I declare the variable, I changed from the 
> default:
>
> *STATIC_URL = '/static/'* 
>
> to: 
>
> *STATIC_URL = 
> '/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/dobbs_portal_blog/static/'*
>
> That is my best guess at attempting resolve the “pretty obvious” error 
> message:
>
> You're using the staticfiles app without having set the STATIC_ROOT 
>> setting to a filesystem path.
>
>
> Yet I am still doing something wrong because invoking python3 
> dobbs_portal_blog/manage.py collectstatic, I still get the same message:
>
> $ python3 dobbs_portal_blog/manage.py collectstatic
>> You have requested to collect static files at the destination location 
>> as specified in your settings.
>> This will overwrite existing files! Are you sure you want to do this?
>> Type 'yes' to continue, or 'no' to cancel: yes Traceback (most recent 
>> call last):  File "dobbs_portal_blog/manage.py", line 22, in 
>> execute_from_command_line(sys.argv) 
>>  File 
>> "/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/__init__.py",
>>  
>> line 364, in execute_from_command_lineutility.execute()  File 
>> "/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/__init__.py",
>>  
>> line 356, in execute
>> self.fetch_command(subcommand).run_from_argv(self.argv) 
>>  File 
>> "/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/base.py",
>>  
>> line 283, in run_from_argvself.execute(*args, **cmd_options)  File 
>> "/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/base.py",
>>  
>> line 330, in executeoutput = self.handle(*args, **options)  File 
>> "/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
>>  
>> line 199, in handlecollected = self.collect()  File 
>> "/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
>>  
>> line 124, in collecthandler(path, prefixed_path, storag

Re: Django 1.11

2017-12-13 Thread minh quang
Thank you!

On Sunday, December 10, 2017 at 10:58:44 AM UTC+7, minh quang wrote:
>
> Hi all, i am begining develop web django. If i buid django web app to 
> manage studen't score result then will i creat what model is?
> ,thanks all?
>

-- 
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/fd479d01-072d-4020-8305-acc08315bb18%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels Model Binding not sending messages

2017-12-13 Thread Zac Kwan
I have a console.log in my javascript that verified is the newly created 
Feed that got sent. This is my binding, consumers and routing class:

#bindings.py
class FeedBinding(WebsocketBinding):

model = Feed
stream = "feed"
fields = ["__all__"]

@classmethod
def group_names(cls, instance):
return ["feed-grp", ]

def has_permission(self, user, action, pk):
return True

# consumers.py
class Demultiplexer(WebsocketDemultiplexer):

print("consumers.py is run")
consumers = {
"feed": FeedBinding.consumer,
}

def connection_groups(self):
return ["feed-grp", ]

# routing.py
channel_routing = [
route_class(Demultiplexer, path="^/binding/"),
]


I still couldn't get the sending to work via admin or DRF API call when 
creating a `Feed` object. This somehow only happens in the production 
setup, runserver works fine.

Really appreciate your help, thanks for the great library!

Cheers
Zac

On Thursday, December 14, 2017 at 2:45:49 AM UTC+8, Andrew Godwin wrote:
>
> That is odd behaviour - have you tried to see if it's actually the group 
> send, or something like trying to send it twice? Can you post your binding 
> configuration?
>
> Andrew
>
> On Wed, Dec 13, 2017 at 4:14 AM, Zac Kwan 
> > wrote:
>
>> In production, I have setup asgi, wsgi and nginx. My javascript frontend 
>> manage connected successfully base on the logs in runworker. However, when 
>> a new model is created (DRF API, Admin or Shell), it does not send a 
>> message to the group where my frontend is connected. It work perfectly in 
>> runserver.
>>
>> I had did some testing in the python manage.py shell and found out that 
>> it work when I try to send a group message myself first.
>>
>> $ python manage.py shell
>>
>> Python 3.6.2 (default, Aug 27 2017, 18:32:19) 
>>
>> [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
>>
>> Type "help", "copyright", "credits" or "license" for more information.
>>
>> (InteractiveConsole)
>>
>>
>> >>> from channels import Group
>> >>> from github_hook.models import Feed
>> >>>
>> >>> Feed.objects.create(name="foo") # Model is created but frontend did 
>> not receive any message
>> >>>
>> >>> Group("news").send({"text": "dsa"}) # After I do this, a print I had 
>> in consumers.py happened
>> >>> consumers.py is run!
>> >>>
>> >>>  Feed.objects.create(name="foo") # Now when i created a new object, 
>> frontend successfully received the mssage
>>
>>
>> The following is my CHANNEL_LAYERS setup:
>>
>> CHANNEL_LAYERS = {
>> "default": {
>> "BACKEND": "asgi_redis.RedisChannelLayer",
>> "CONFIG": {
>> "hosts": [os.environ.get('REDIS_URL', 
>> 'redis://localhost:6379')],
>> },
>> "ROUTING": "github_hook.routing.channel_routing",
>> },
>> }
>>
>>
>> I had been on this for 2 weeks, still caa't figure out what is wrong. Can 
>> anyone help me figure out whats wrong? 
>>
>> It seems to me that my application that is served by WSGI, when created a 
>> model via admin, it does not trigger the message sending. It seems to be 
>> missing some init on consumers.py? 
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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/eafc6aa0-d620-4e2a-af22-a715845fb463%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/7287733f-0fba-41f0-894a-fe16772c96c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help with Django Models

2017-12-13 Thread Mike Dewhirst

On 14/12/2017 11:14 AM, Udit Vashisht wrote:
Thanks for the reply. I am new to python and django. Will have to 
google a lot to understand your solution :-)


Look at models.ForeignKey ...

https://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey

When you add a foreign key field to a table, the Django Admin form 
offers a choice of all the values from the table you specify.


If you are writing your own forms this might help ...

https://stackoverflow.com/questions/5104277/field-choices-as-queryset

A custom command just needs to follow a specific pattern and contain 
functions with specific names so the command can be executed like python 
manage.py fetch_web_values


https://docs.djangoproject.com/en/2.0/howto/custom-management-commands/

Cheers

Mike




On Dec 13, 2017 19:12, "Mike Dewhirst" > wrote:


On 14/12/2017 3:15 AM, Udit Vashisht wrote:

I have an outside python function which reads a csv from web
and fetch certain data in forms of tuple. So that i can use
that tuple in my python models for choices in one of the
fields. Till now i am running the function independently and
copying the returned tuple to my models.py for choices. But
there must be some better way. like pickling it etc etc. Can
anyone help me with that?


I suggest you import the csv data into a table using a manage.py
custom command. Then you need to point your field requiring
choices at that table.

You could perhaps then run your manage.py command on a cron schedule?


-- 
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/723351d1-aaae-4784-8c78-ae114e5a64c2%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/23dd4164-e27f-c49d-ea38-d061babb35c7%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Help with Django Models

2017-12-13 Thread Mike Dewhirst

On 14/12/2017 3:15 AM, Udit Vashisht wrote:
I have an outside python function which reads a csv from web and fetch 
certain data in forms of tuple. So that i can use that tuple in my 
python models for choices in one of the fields. Till now i am running 
the function independently and copying the returned tuple to my 
models.py for choices. But there must be some better way. like 
pickling it etc etc. Can anyone help me with that?


I suggest you import the csv data into a table using a manage.py custom 
command. Then you need to point your field requiring choices at that table.


You could perhaps then run your manage.py command on a cron schedule?



--
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/723351d1-aaae-4784-8c78-ae114e5a64c2%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/b1f6bc2f-3dc9-dc19-6a99-28aab11b5a06%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Django on windows 10 and tomcat

2017-12-13 Thread Arnap
Am new to django and developing champion windows to be deployed in to cat, but 
getting error while deploying .war in tomcat6. Error is: 
cannot load 'application's, no module named mysite
Where mysite is my application name, kindly help me

-- 
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/f22e321a-f4b9-4e1c-a632-e48c0e2d097f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Help with Django Models

2017-12-13 Thread Udit Vashisht
I have an outside python function which reads a csv from web and fetch 
certain data in forms of tuple. So that i can use that tuple in my python 
models for choices in one of the fields. Till now i am running the function 
independently and copying the returned tuple to my models.py for choices. 
But there must be some better way. like pickling it etc etc. Can anyone 
help me with that? 

-- 
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/723351d1-aaae-4784-8c78-ae114e5a64c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels Model Binding not sending messages

2017-12-13 Thread Andrew Godwin
That is odd behaviour - have you tried to see if it's actually the group
send, or something like trying to send it twice? Can you post your binding
configuration?

Andrew

On Wed, Dec 13, 2017 at 4:14 AM, Zac Kwan  wrote:

> In production, I have setup asgi, wsgi and nginx. My javascript frontend
> manage connected successfully base on the logs in runworker. However, when
> a new model is created (DRF API, Admin or Shell), it does not send a
> message to the group where my frontend is connected. It work perfectly in
> runserver.
>
> I had did some testing in the python manage.py shell and found out that it
> work when I try to send a group message myself first.
>
> $ python manage.py shell
>
> Python 3.6.2 (default, Aug 27 2017, 18:32:19)
>
> [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
>
> Type "help", "copyright", "credits" or "license" for more information.
>
> (InteractiveConsole)
>
>
> >>> from channels import Group
> >>> from github_hook.models import Feed
> >>>
> >>> Feed.objects.create(name="foo") # Model is created but frontend did
> not receive any message
> >>>
> >>> Group("news").send({"text": "dsa"}) # After I do this, a print I had
> in consumers.py happened
> >>> consumers.py is run!
> >>>
> >>>  Feed.objects.create(name="foo") # Now when i created a new object,
> frontend successfully received the mssage
>
>
> The following is my CHANNEL_LAYERS setup:
>
> CHANNEL_LAYERS = {
> "default": {
> "BACKEND": "asgi_redis.RedisChannelLayer",
> "CONFIG": {
> "hosts": [os.environ.get('REDIS_URL',
> 'redis://localhost:6379')],
> },
> "ROUTING": "github_hook.routing.channel_routing",
> },
> }
>
>
> I had been on this for 2 weeks, still caa't figure out what is wrong. Can
> anyone help me figure out whats wrong?
>
> It seems to me that my application that is served by WSGI, when created a
> model via admin, it does not trigger the message sending. It seems to be
> missing some init on consumers.py?
>
> --
> 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/eafc6aa0-d620-4e2a-af22-a715845fb463%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/CAFwN1uppTz%2B5%2BnR48ZjZ442CqEW2J39d9yVKT4qQXNy8dO6%3DGA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels: Model Binding not sending out message to group

2017-12-13 Thread Andrew Godwin
Since you double-posted, I will reply to the other thread.

On Wed, Dec 13, 2017 at 12:00 AM, Zac Kwan  wrote:

> I have nginx, uwsgi and asgi setup correctly. With my javascript frontend,
> it is connected to base on the worker log that contains the demultiplexer
> response. However, when I try to create a model (via API, admin or shell)
> it does not send a message to the worker. In `runserver` all work fine.
>
> So I try creating the model in python manage.py shell.
>
> $ python manage.py shell
>
> Python 3.5.1 (v3.5.1:37a07cee5969, Dec  5 2015, 21:12:44)
>
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
>
> Type "help", "copyright", "credits" or "license" for more information.
>
> (InteractiveConsole)
> >>> from project.models import Feed
>
> >>> from channels import Group
>
> >>>
> >>> Feed.objects.create(name="a1") #This does not send a message to my
> frontend
> >>>
> >>> Group('dsadsa').send({"text": "hi"}) # somehow, after doing this no
> matter which group I send to, it will start working in shell.
>
> >>>
> >>> Feed.objects.create(name="a99") #Now when i do this again, it work.
> My frontend receive a message
>
>
>
> I not really sure what I did wrong or is it a bug with Django Channels.
> There is no logs message about binding message being send out by the worker
> even when I do it successfully in the shell.
>
> Somehow, I find out that after I try to send a Group message to any group,
> creating the Feed again will sends out the message correctly.
>
> The following is my code for connecting to redis:
> CHANNEL_LAYERS = {
>"default": {
>"BACKEND": "asgi_redis.RedisChannelLayer",
>"CONFIG": {
>"hosts": [os.environ.get('REDIS_URL', 'redis://localhost:6379'
> )],
>},
>"ROUTING": "github_hook.routing.channel_routing",
>},
> }
>
> Any kind soul know what is the problem? Am I missing something that's why
> binding does not work in production?
>
> --
> 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/17cbdbbe-731f-4349-b3a7-874f4faded8a%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/CAFwN1uoEKVPdGTV6sgukiAD4n61_%2BsTNcTK%2BrXeotqikFqdWYw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [OT] Is Trump planning to break the Internet?

2017-12-13 Thread Chris Seberino
Maybe this will shed some light

https://medium.com/@cseberino/toll-equality-b11b07267456

>
>

-- 
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/de608f15-6798-4d0f-accb-eea176d85531%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: can't create app in putty

2017-12-13 Thread Jani Tiainen

Hi,

Looks like you have added "app.app" in your installed apps _before_ 
creating actual app with that name. When trying to form environment for 
executing management command Django fails to find your app.


So either remove that app.app (which seems that it's not even name of 
the app you want to have), create your "webapp" app and after creating 
it add it to settings.py



On 13.12.2017 8.54, Виктор Копылец wrote:
I buy hosting and create project. Then i decided create app. I write 
python manage.py startapp webapp and jumps out error :



  Traceback (most recent call last):
  File "manage.py", line 22, in 
    execute_from_command_line(sys.argv)
  File 
"/home2/victorko/virtualenv/app/3.4/lib/python3.4/site-packages/django/core/management/__init__.py", 
line 364, in execute_from_command_line

    utility.execute()
  File 
"/home2/victorko/virtualenv/app/3.4/lib/python3.4/site-packages/django/core/management/__init__.py", 
line 308, in execute

    settings.INSTALLED_APPS
  File 
"/home2/victorko/virtualenv/app/3.4/lib/python3.4/site-packages/django/conf/__init__.py", 
line 56, in __getattr__

    self._setup(name)
  File 
"/home2/victorko/virtualenv/app/3.4/lib/python3.4/site-packages/django/conf/__init__.py", 
line 41, in _setup

    self._wrapped = Settings(settings_module)
  File 
"/home2/victorko/virtualenv/app/3.4/lib/python3.4/site-packages/django/conf/__init__.py", 
line 110, in __init__

    mod = importlib.import_module(self.SETTINGS_MODULE)
  File 
"/home2/victorko/virtualenv/app/3.4/lib64/python3.4/importlib/__init__.py", 
line 109, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 2254, in _gcd_import
  File "", line 2237, in _find_and_load
  File "", line 2212, in 
_find_and_load_unlocked
  File "", line 321, in 
_call_with_frames_removed

  File "", line 2254, in _gcd_import
  File "", line 2237, in _find_and_load
  File "", line 2224, in 
_find_and_load_unlocked

  ImportError: No module named 'app.app'


--
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/3cf5b8f8-dcdc-4827-9af6-0878fb33ce22%40googlegroups.com 
.

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


--
Jani Tiainen

--
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/955c9181-97d9-9d40-fbdc-ce292dca3e3b%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: can't create app in putty

2017-12-13 Thread Etienne Robillard

Hi,

Perhaps you need to set PYTHONPATH to the location where your app module 
is located.


HTH

Etienne


Le 2017-12-13 à 01:54, Виктор Копылец a écrit :
I buy hosting and create project. Then i decided create app. I write 
python manage.py startapp webapp and jumps out error :



  Traceback (most recent call last):
  File "manage.py", line 22, in 
    execute_from_command_line(sys.argv)
  File 
"/home2/victorko/virtualenv/app/3.4/lib/python3.4/site-packages/django/core/management/__init__.py", 
line 364, in execute_from_command_line

    utility.execute()
  File 
"/home2/victorko/virtualenv/app/3.4/lib/python3.4/site-packages/django/core/management/__init__.py", 
line 308, in execute

    settings.INSTALLED_APPS
  File 
"/home2/victorko/virtualenv/app/3.4/lib/python3.4/site-packages/django/conf/__init__.py", 
line 56, in __getattr__

    self._setup(name)
  File 
"/home2/victorko/virtualenv/app/3.4/lib/python3.4/site-packages/django/conf/__init__.py", 
line 41, in _setup

    self._wrapped = Settings(settings_module)
  File 
"/home2/victorko/virtualenv/app/3.4/lib/python3.4/site-packages/django/conf/__init__.py", 
line 110, in __init__

    mod = importlib.import_module(self.SETTINGS_MODULE)
  File 
"/home2/victorko/virtualenv/app/3.4/lib64/python3.4/importlib/__init__.py", 
line 109, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 2254, in _gcd_import
  File "", line 2237, in _find_and_load
  File "", line 2212, in 
_find_and_load_unlocked
  File "", line 321, in 
_call_with_frames_removed

  File "", line 2254, in _gcd_import
  File "", line 2237, in _find_and_load
  File "", line 2224, in 
_find_and_load_unlocked

  ImportError: No module named 'app.app'


--
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/3cf5b8f8-dcdc-4827-9af6-0878fb33ce22%40googlegroups.com 
.

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


--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

--
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/a185d63f-4d41-68b5-9829-969a957a6594%40yandex.com.
For more options, visit https://groups.google.com/d/optout.


Django Channels Model Binding not sending messages

2017-12-13 Thread Zac Kwan
In production, I have setup asgi, wsgi and nginx. My javascript frontend 
manage connected successfully base on the logs in runworker. However, when 
a new model is created (DRF API, Admin or Shell), it does not send a 
message to the group where my frontend is connected. It work perfectly in 
runserver.

I had did some testing in the python manage.py shell and found out that it 
work when I try to send a group message myself first.

$ python manage.py shell

Python 3.6.2 (default, Aug 27 2017, 18:32:19) 

[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

(InteractiveConsole)


>>> from channels import Group
>>> from github_hook.models import Feed
>>>
>>> Feed.objects.create(name="foo") # Model is created but frontend did not 
receive any message
>>>
>>> Group("news").send({"text": "dsa"}) # After I do this, a print I had in 
consumers.py happened
>>> consumers.py is run!
>>>
>>>  Feed.objects.create(name="foo") # Now when i created a new object, 
frontend successfully received the mssage


The following is my CHANNEL_LAYERS setup:

CHANNEL_LAYERS = {
"default": {
"BACKEND": "asgi_redis.RedisChannelLayer",
"CONFIG": {
"hosts": [os.environ.get('REDIS_URL', 
'redis://localhost:6379')],
},
"ROUTING": "github_hook.routing.channel_routing",
},
}


I had been on this for 2 weeks, still caa't figure out what is wrong. Can 
anyone help me figure out whats wrong? 

It seems to me that my application that is served by WSGI, when created a 
model via admin, it does not trigger the message sending. It seems to be 
missing some init on consumers.py? 

-- 
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/eafc6aa0-d620-4e2a-af22-a715845fb463%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


can't create app in putty

2017-12-13 Thread Виктор Копылец
I buy hosting and create project. Then i decided create app. I write python 
manage.py startapp webapp and jumps out error : 


  Traceback (most recent call last):
  File "manage.py", line 22, in 
execute_from_command_line(sys.argv)
  File 
"/home2/victorko/virtualenv/app/3.4/lib/python3.4/site-packages/django/core/management/__init__.py",
 
line 364, in execute_from_command_line
utility.execute()
  File 
"/home2/victorko/virtualenv/app/3.4/lib/python3.4/site-packages/django/core/management/__init__.py",
 
line 308, in execute
settings.INSTALLED_APPS
  File 
"/home2/victorko/virtualenv/app/3.4/lib/python3.4/site-packages/django/conf/__init__.py",
 
line 56, in __getattr__
self._setup(name)
  File 
"/home2/victorko/virtualenv/app/3.4/lib/python3.4/site-packages/django/conf/__init__.py",
 
line 41, in _setup
self._wrapped = Settings(settings_module)
  File 
"/home2/victorko/virtualenv/app/3.4/lib/python3.4/site-packages/django/conf/__init__.py",
 
line 110, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
  File 
"/home2/victorko/virtualenv/app/3.4/lib64/python3.4/importlib/__init__.py", 
line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 2254, in _gcd_import
  File "", line 2237, in _find_and_load
  File "", line 2212, in 
_find_and_load_unlocked
  File "", line 321, in 
_call_with_frames_removed
  File "", line 2254, in _gcd_import
  File "", line 2237, in _find_and_load
  File "", line 2224, in 
_find_and_load_unlocked
  ImportError: No module named 'app.app'


-- 
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/3cf5b8f8-dcdc-4827-9af6-0878fb33ce22%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Channels: Model Binding not sending out message to group

2017-12-13 Thread Zac Kwan
I have nginx, uwsgi and asgi setup correctly. With my javascript frontend, 
it is connected to base on the worker log that contains the demultiplexer 
response. However, when I try to create a model (via API, admin or shell) 
it does not send a message to the worker. In `runserver` all work fine.

So I try creating the model in python manage.py shell.

$ python manage.py shell

Python 3.5.1 (v3.5.1:37a07cee5969, Dec  5 2015, 21:12:44) 

[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

(InteractiveConsole)
>>> from project.models import Feed

>>> from channels import Group

>>>
>>> Feed.objects.create(name="a1") #This does not send a message to my 
frontend
>>>
>>> Group('dsadsa').send({"text": "hi"}) # somehow, after doing this no 
matter which group I send to, it will start working in shell.

>>>
>>> Feed.objects.create(name="a99") #Now when i do this again, it work. My 
frontend receive a message
 


I not really sure what I did wrong or is it a bug with Django Channels. 
There is no logs message about binding message being send out by the worker 
even when I do it successfully in the shell. 

Somehow, I find out that after I try to send a Group message to any group, 
creating the Feed again will sends out the message correctly.

The following is my code for connecting to redis:
CHANNEL_LAYERS = {
   "default": {
   "BACKEND": "asgi_redis.RedisChannelLayer",
   "CONFIG": {
   "hosts": [os.environ.get('REDIS_URL', 'redis://localhost:6379')],
   },
   "ROUTING": "github_hook.routing.channel_routing",
   },
}

Any kind soul know what is the problem? Am I missing something that's why 
binding does not work in production?

-- 
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/17cbdbbe-731f-4349-b3a7-874f4faded8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.