Django 1.8 migrate - relation “django_content_type” already exists

2015-06-16 Thread Adam Teale
Hi Guys,

Any idea why I would be getting this error when I try to migrate?

django.db.utils.ProgrammingError: relation "django_content_type"

I am using using django 1.8 & postgresql

Thanks!

Adam

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d370a81f-2870-4d3d-8e7c-9f035131bc17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ProgrammingError: relation "django_content_type" already exists

2015-06-16 Thread Adam Teale
Hey guys did you manage to get anywhere with this?




On Tuesday, 24 March 2015 03:00:28 UTC-3, Mike Dewhirst wrote:
>
> This is my first stab at upgrading directly from Django 1.6.11 to 1.81c 
> to see what needs to be done. I thought I'd skip 1.7.x - is that a bad 
> idea? Is there some step in 1.7.x which eases the path to 1.8.x? 
>
> On first starting the project up using runserver on localhost it advises: 
>
> Python:   3.4 
> Django:   1.8c1 
> Database: ssds.climate.com.au 
> Postgres: 9.1 
> 16:18:54 
>
> Performing system checks... 
>
> System check identified no issues (0 silenced). 
>
> You have unapplied migrations; your app may not work properly until they 
> are applied. 
> Run 'python manage.py migrate' to apply them. 
>
> See below. Not sure where to go from here. Any ideas? 
>
> Thanks 
>
> Mike 
>
> On running manage.py migrate it returns a ProgrammingError as follows: 
>
> (xxex3) C:\Users\mike\env\xxex3\ssds>python manage.py migrate 
> Operations to perform: 
>Synchronize unmigrated apps: admindocs, messages, credit, refer, 
> company, workplace, staticfiles, substance, common 
>Apply all migrations: contenttypes, sessions, auth, sites, admin 
> Synchronizing apps without migrations: 
>Creating tables... 
>  Running deferred SQL... 
>Installing custom SQL... 
> Running migrations: 
>Rendering model states... DONE 
>Applying contenttypes.0001_initial...Traceback (most recent call last): 
>File 
> "C:\Users\mike\env\xxex3\lib\site-packages\django\db\backends\utils.py", 
> line 62, in execute 
>  return self.cursor.execute(sql) 
> psycopg2.ProgrammingError: relation "django_content_type" already exists 
>
>
> The above exception was the direct cause of the following exception: 
>
> Traceback (most recent call last): 
>File "manage.py", line 24, in  
>  execute_from_command_line(sys.argv) 
>File 
> "C:\Users\mike\env\xxex3\lib\site-packages\django\core\management\__init__.py",
>  
>
> line 338, in execute_from_command_line 
>  utility.execute() 
>File 
> "C:\Users\mike\env\xxex3\lib\site-packages\django\core\management\__init__.py",
>  
>
> line 330, in execute 
>  self.fetch_command(subcommand).run_from_argv(self.argv) 
>File 
> "C:\Users\mike\env\xxex3\lib\site-packages\django\core\management\base.py", 
>
> line 390, in run_from_argv 
>  self.execute(*args, **cmd_options) 
>File 
> "C:\Users\mike\env\xxex3\lib\site-packages\django\core\management\base.py", 
>
> line 441, in execute 
>  output = self.handle(*args, **options) 
>File 
> "C:\Users\mike\env\xxex3\lib\site-packages\django\core\management\commands\migrate.py",
>  
>
> line 221, in handle 
>  executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial) 
>File 
> "C:\Users\mike\env\xxex3\lib\site-packages\django\db\migrations\executor.py", 
>
> line 94, in migrate 
>  self.apply_migration(states[migration], migration, fake=fake, 
> fake_initial=fake_initial) 
>File 
> "C:\Users\mike\env\xxex3\lib\site-packages\django\db\migrations\executor.py", 
>
> line 131, in apply_migration 
>  state = migration.apply(state, schema_editor) 
>File 
> "C:\Users\mike\env\xxex3\lib\site-packages\django\db\migrations\migration.py",
>  
>
> line 111, in apply 
>  operation.database_forwards(self.app_label, schema_editor, 
> old_state, project_state) 
>
>File 
> "C:\Users\mike\env\xxex3\lib\site-packages\django\db\migrations\operations\models.py",
>  
>
> line 59, in database_forwards 
>  schema_editor.create_model(model) 
>File 
> "C:\Users\mike\env\xxex3\lib\site-packages\django\db\backends\base\schema.py",
>  
>
> line 282, in create_model 
>  self.execute(sql, params or None) 
>File 
> "C:\Users\mike\env\xxex3\lib\site-packages\django\db\backends\base\schema.py",
>  
>
> line 107, in execute 
>  cursor.execute(sql, params) 
>File 
> "C:\Users\mike\env\xxex3\lib\site-packages\django\db\backends\utils.py", 
> line 64, in execute 
>  return self.cursor.execute(sql, params) 
>File "C:\Users\mike\env\xxex3\lib\site-packages\django\db\utils.py", 
> line 97, in __exit__ 
>  six.reraise(dj_exc_type, dj_exc_value, traceback) 
>File "C:\Users\mike\env\xxex3\lib\site-packages\django\utils\six.py", 
> line 658, in reraise 
>  raise value.with_traceback(tb) 
>File 
> "C:\Users\mike\env\xxex3\lib\site-packages\django\db\backends\utils.py", 
> line 62, in execute 
>  return self.cursor.execute(sql) 
> django.db.utils.ProgrammingError: relation "django_content_type" already 
> exists 
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://

looking for recommendations for django app for managing tv commercial post production

2014-02-20 Thread Adam Teale
Hi Guys,

I'm someone might be able to give me a recommendation for an existing 
django application that we might be able to check out for our small 
company. 

We are 10 people working in tv commercial post production. We work with 
reasonable amount of data from video, photos, graphics, audio.
I'm hoping to find something that gets us off to a good start regarding 
user management and authentication, hopefully time tracking, client 
management and asset management.

There is a cool application that might be great for us in the long term 
called ftrack  that probably does most of the things we 
would want to do, but it'll take some serious convincing to get the guys to 
spend the money :)
So i'm hoping their might be an open source tool out there that might be a 
good starting point to build our own rather than starting from scratch.

I'd appreciate any thoughts anyone might have.

Cheers!

Adam

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/59438170-27a9-4ba8-8b49-89c6dcb17268%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(1364, "Field 'id' doesn't have a default value") - mysql issue?

2014-04-09 Thread Adam Teale
Hi Guys

I have been working on a django app that was going well using an sqlite db.
I've moved it over to mysql and imported the database

Everything looks good

But when I try to use the django comment system that was working well on 
the sqlite db before I get:

OperationalError at /comments/post/
(1364, "Field 'id' doesn't have a default value")
Request Method: POST
Request URL: http://192.168.1.143/comments/post/
Django Version: 1.6.2
Exception Type: OperationalError
Exception Value: 
(1364, "Field 'id' doesn't have a default value")
Exception Location: 
/Users/admin/Dropbox/mstudio/code/mBrain/mbrain/venv/lib/python2.7/site-packages/MySQLdb/connections.py
 
in defaulterrorhandler, line 36
Python Executable: 


I'm a little lost - do i need to set a default value for 
the django.contrib.comments model?
And how would i do that if I needed to - this has an Object ID field - i 
don't know how I'd set that up


Any ideas? What am i missing?

Many thanks!

Adam

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/18894c72-24c9-41cd-85a1-4dc09072dfb8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: (1364, "Field 'id' doesn't have a default value") - mysql issue?

2014-04-10 Thread Adam Teale
Hello Mark, thanks for responding to my question

I'm using the built-in django commenting system - django.contrib.messages

It was fine with the sqlite db

I had done a syncdb and the app was working, but it just seems that now
when I add a comment to something there is this issue.

Do I need to manually add the autofield to my comment subclass?

Thanks!

Adam



El 09-04-2014, a las 19:46, Mark Furbee  escribió:

You say you imported the database. Did you use syncdb to set up the tables?
It sounds like your comment_id field in MySQL is not set as an
auto-incrementing primary key field. Do you have access to that MySQL
database to check, and or update that field definition?


On Wed, Apr 9, 2014 at 2:42 PM, Adam Teale  wrote:

> Hi Guys
>
> I have been working on a django app that was going well using an sqlite db.
> I've moved it over to mysql and imported the database
>
> Everything looks good
>
> But when I try to use the django comment system that was working well on
> the sqlite db before I get:
>
> OperationalError at /comments/post/
> (1364, "Field 'id' doesn't have a default value")
> Request Method: POST
> Request URL: http://192.168.1.143/comments/post/
> Django Version: 1.6.2
> Exception Type: OperationalError
> Exception Value:
> (1364, "Field 'id' doesn't have a default value")
> Exception Location: 
> /Users/admin/Dropbox/mstudio/code/mBrain/mbrain/venv/lib/python2.7/site-packages/MySQLdb/connections.py
> in defaulterrorhandler, line 36
> Python Executable:
>
>
> I'm a little lost - do i need to set a default value for
> the django.contrib.comments model?
> And how would i do that if I needed to - this has an Object ID field - i
> don't know how I'd set that up
>
>
> Any ideas? What am i missing?
>
> Many thanks!
>
> Adam
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/18894c72-24c9-41cd-85a1-4dc09072dfb8%40googlegroups.com<https://groups.google.com/d/msgid/django-users/18894c72-24c9-41cd-85a1-4dc09072dfb8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

 --
You received this message because you are subscribed to a topic in the
Google Groups "Django users" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/django-users/mBcX6IRYwko/unsubscribe.
To unsubscribe from this group and all its topics, 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CACMDPqHbdXorWvLLc%2BDy3eEdvd9Q7gaK6-aCqzuG_X9HvSjz%3DQ%40mail.gmail.com<https://groups.google.com/d/msgid/django-users/CACMDPqHbdXorWvLLc%2BDy3eEdvd9Q7gaK6-aCqzuG_X9HvSjz%3DQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMse0ZhPFFoLwm6naWf-Z%3DiQMEJik3YpDo87BHeC3fVumk2CLw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: (1364, "Field 'id' doesn't have a default value") - mysql issue?

2014-04-10 Thread Adam Teale
sorry I meant django.contrib.comments - not messages

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMse0ZjL8V85OT9OuvrbtiwXnYPDh%3DAa9Pzk2UajuagP2K0LUw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: (1364, "Field 'id' doesn't have a default value") - mysql issue?

2014-04-10 Thread Adam Teale
ok, i just enabled auto increment to the comment id field

Seems to work fine!

Now is there any way that this could have been set automatically from
django? So i don't have this issue in the future)

Thanks!

On Thu, Apr 10, 2014 at 9:47 AM, Adam Teale  wrote:

> sorry I meant django.contrib.comments - not messages
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMse0Zh0%2B-ALYHQtXrXFufFraVC87uWgF%2Bd34DjnHk3a2BEnuw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: (1364, "Field 'id' doesn't have a default value") - mysql issue?

2014-04-10 Thread Adam Teale
hmmm it seems that anything in the database is not set to auto increment



On Thu, Apr 10, 2014 at 11:04 AM, Adam Teale  wrote:

> ok, i just enabled auto increment to the comment id field
>
> Seems to work fine!
>
> Now is there any way that this could have been set automatically from
> django? So i don't have this issue in the future)
>
> Thanks!
>
>
> On Thu, Apr 10, 2014 at 9:47 AM, Adam Teale  wrote:
>
>> sorry I meant django.contrib.comments - not messages
>>
>
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMse0ZihTyZg_N3RviCv-mRa8FFLp%3DiLB%2BQXHd5xe_-8V%3DVL3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Apache, mod_wsgi and sharing videos to devices/machines

2014-04-11 Thread Adam Teale
Hi Guys,

If someone has the time to take a look at this i'd really appreciate it.

I am in the process of developing a small django app to manage some aspects 
of our production company - users, projects etc...

I am in a moment where I would like to get some people on the local network 
to start playing around with it and be able to view video and audio files 
from our server's project directory (for the moment i am just using dummy 
files from a directory on my local machine).

I have set up my machine to allow for users to access the django app via my 
ip address and seems to work - they can login and see pages. 
Eventually this will run on our server.
The app us running out of my user folder (mac os x 10.9 installed).
I have django working with an mysql db.
I think i have mod_wsgi installed ok.


So what I am hoping to achieve is that users on the local network, and 
eventually out of the building on their telephones, can view projects 
through the django app and preview proxy versions of the media - such as 
mp4 video files.

This seems to work ok - but I am getting errors when pages with media that 
are visited.
The media is served though in some caes - in this case mp4 files.
But devices on wifi don't seem to be able to see the media.

Either way i get errors

I imagine that it is because I need to implement Apache and mod_wsgi. So I 
am trying to follow this:
https://docs.djangoproject.com/en/1.5/howto/deployment/wsgi/modwsgi/

I am hoping someone out there can just give me some ideas or comments about 
what I am doing, if I am making some obvious mistakes, and if you can help 
me work out this error.

Many thanks!


Adam


error:

[11/Apr/2014 13:21:43] "GET /proyectos/1/ HTTP/1.1" 200 7411

[11/Apr/2014 13:21:43] "GET 
/Users/admin/Dropbox/mstudio/code/mBrain/mbrain/mbrain/static/css/bootstrap.css 
HTTP/1.1" 304 0

[11/Apr/2014 13:21:43] "GET 
/Users/admin/Dropbox/mstudio/code/mBrain/mbrain/mbrain/static/0124_Entel/edit/export/20140401/2053_canal13_marzo_20140408_1720.m4v
 
HTTP/1.1" 200 4709

Traceback (most recent call last):

  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py",
 
line 86, in run

self.finish_response()

  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py",
 
line 128, in finish_response

self.write(data)

  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py",
 
line 217, in write

self._write(data)

  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py",
 
line 324, in write

self.flush()

  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py",
 
line 303, in flush

self._sock.sendall(view[write_offset:write_offset+buffer_size])

error: [Errno 32] Broken pipe

*[11/Apr/2014 13:21:43] "GET 
/Users/admin/Dropbox/mstudio/code/mBrain/mbrain/mbrain/static/0124_Entel/edit/export/20140401/2053_canal13_marzo_20140408_1720.m4v
 
HTTP/1.1" 500 59*



Exception happened during processing of request from ('192.168.1.143', 
59968)

Traceback (most recent call last):

  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",
 
line 593, in process_request_thread

self.finish_request(request, client_address)

  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",
 
line 334, in finish_request

self.RequestHandlerClass(request, client_address, self)

  File 
"/Users/admin/Dropbox/mstudio/code/mBrain/venv/lib/python2.7/site-packages/django/core/servers/basehttp.py",
 
line 126, in __init__

super(WSGIRequestHandler, self).__init__(*args, **kwargs)

  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",
 
line 651, in __init__

self.finish()

  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",
 
line 710, in finish

self.wfile.close()

  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py",
 
line 279, in close

self.flush()

  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py",
 
line 303, in flush

self._sock.sendall(view[write_offset:write_offset+buffer_size])

error: [Errno 32] Broken pipe



-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e8df8126-651f-4527-aa6b-a66e88bf0206%40googlegroups.com.
For more options, vis

Re: Apache, mod_wsgi and sharing videos to devices/machines

2014-04-11 Thread Adam Teale
Hmm seems that the error is just part of working with the development
server.
I shall work on trying to put this into production mode
Cheers


On Fri, Apr 11, 2014 at 10:31 AM, Adam Teale  wrote:

> Hi Guys,
>
> If someone has the time to take a look at this i'd really appreciate it.
>
> I am in the process of developing a small django app to manage some
> aspects of our production company - users, projects etc...
>
> I am in a moment where I would like to get some people on the local
> network to start playing around with it and be able to view video and audio
> files from our server's project directory (for the moment i am just using
> dummy files from a directory on my local machine).
>
> I have set up my machine to allow for users to access the django app via
> my ip address and seems to work - they can login and see pages.
> Eventually this will run on our server.
> The app us running out of my user folder (mac os x 10.9 installed).
> I have django working with an mysql db.
> I think i have mod_wsgi installed ok.
>
>
> So what I am hoping to achieve is that users on the local network, and
> eventually out of the building on their telephones, can view projects
> through the django app and preview proxy versions of the media - such as
> mp4 video files.
>
> This seems to work ok - but I am getting errors when pages with media that
> are visited.
> The media is served though in some caes - in this case mp4 files.
> But devices on wifi don't seem to be able to see the media.
>
> Either way i get errors
>
> I imagine that it is because I need to implement Apache and mod_wsgi. So I
> am trying to follow this:
> https://docs.djangoproject.com/en/1.5/howto/deployment/wsgi/modwsgi/
>
> I am hoping someone out there can just give me some ideas or comments
> about what I am doing, if I am making some obvious mistakes, and if you can
> help me work out this error.
>
> Many thanks!
>
>
> Adam
>
>
> error:
>
> [11/Apr/2014 13:21:43] "GET /proyectos/1/ HTTP/1.1" 200 7411
>
> [11/Apr/2014 13:21:43] "GET
> /Users/admin/Dropbox/mstudio/code/mBrain/mbrain/mbrain/static/css/bootstrap.css
> HTTP/1.1" 304 0
>
> [11/Apr/2014 13:21:43] "GET
> /Users/admin/Dropbox/mstudio/code/mBrain/mbrain/mbrain/static/0124_Entel/edit/export/20140401/2053_canal13_marzo_20140408_1720.m4v
> HTTP/1.1" 200 4709
>
> Traceback (most recent call last):
>
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py",
> line 86, in run
>
> self.finish_response()
>
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py",
> line 128, in finish_response
>
> self.write(data)
>
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py",
> line 217, in write
>
> self._write(data)
>
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py",
> line 324, in write
>
> self.flush()
>
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py",
> line 303, in flush
>
> self._sock.sendall(view[write_offset:write_offset+buffer_size])
>
> error: [Errno 32] Broken pipe
>
> *[11/Apr/2014 13:21:43] "GET
> /Users/admin/Dropbox/mstudio/code/mBrain/mbrain/mbrain/static/0124_Entel/edit/export/20140401/2053_canal13_marzo_20140408_1720.m4v
> HTTP/1.1" 500 59*
>
> 
>
> Exception happened during processing of request from ('192.168.1.143',
> 59968)
>
> Traceback (most recent call last):
>
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",
> line 593, in process_request_thread
>
> self.finish_request(request, client_address)
>
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",
> line 334, in finish_request
>
> self.RequestHandlerClass(request, client_address, self)
>
>   File
> "/Users/admin/Dropbox/mstudio/code/mBrain/venv/lib/python2.7/site-packages/django/core/servers/basehttp.py",
> line 126, in __init__
>
> super(WSGIRequestHandler, self).__init__(*args, **kwargs)
>
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",
> line 651, in __init__
>
> self.finish()
>
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",
> line 710, in finish
>
> self.w

django, mod_wsgi, apache and sharing media files (video) from a separate directory

2014-04-20 Thread Adam Teale


Hi Guys,


I am building a django app that runs out of my /Users/me/Dropbox directory.


Localhost is pointed at my /Users/me/Sites directory.


mod_wsgi installed.

apache installed

django installed and app working fine in development mode


I am trying to embed media in a template

This media comes from a directory outside of the django app - in the root 
of the machine - /PROYECTOS


The permissions for the directories and preceding directories are readable 
by _www


I think that I understand that

- mod_wsgi will serve the dynamic files

- apache will serve the static files like the css and template files, as 
well as the media files I am referencing in the /PROYECTOS directory


I have the following in my settings.py:

STATICFILES_DIRS = (os.path.join(BASE, "static"), )

STATIC_URL = "/static/"

MEDIA_URL = "/PROYECTOS/"

WSGI_APPLICATION = 'mbrain.wsgi.application'


In the /etc/apache2/extra/vhosts/localhost.conf I have:





 DocumentRoot "/Users/me/Sites/localhost"

ServerName localhost


 WSGIDaemonProcess localhost 
python-path=/Users/me/Dropbox/mBrain_Adam/mbrain/:/Users/me/Dropbox/mBrain_Adam/mbrain/venv/include/python2.7

WSGIProcessGroup localhost


 Alias /proyectos/ /PROYECTOS/


 

Require all granted




 WSGIScriptAlias / /Users/me/Dropbox/mBrain_Adam/mbrain/mbrain/wsgi.py


 



Require all granted









So to embed a media file in a template I have this as the url:

{{ MEDIA_URL }}{{ asset.assetPath }}


When I load the page in a browser the console shows the fully expanded path 
for the media asset but with a 404 error - HTTP/1.1" 404 3045.


I’d really appreciate any feedback on whether I am approaching this the 
right way or if I have completely missed the concept.

Also any help on that 404 error would be appreciated.


Cheers!


Adam

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e6294564-01f1-449c-8cfb-e8dd474bda0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django comment system - content_type

2014-04-22 Thread Adam Teale
Hi Guys,

I'm attempting to replace the django.contrib comment app's "post_comment" 
using a view in views.py.

I have it working but I would like to check that I am doing it in an ok 
django friendly way.

The content_type that the request.POST['content_type'] returns is:

`myapp.mymodel`

When I try to use this as a content_type using: 
`"ContentType.objects.get_for_model(request.POST['content_type']).pk`
I get an error:

'unicode' object has no attribute '_meta' 

Obviously it needs to be an object model - I need it to return an instance 
of *mymodel* so that I can add it to the Comment object and save it.

To get this to work I have used :

myappStr = string.split(myapp.mymodel,'.')[0]   
mymodelStr = string.split(myapp.mymodel,'.')[-1]

contentType = ContentType.objects.get_by_natural_key(myappStr, 
mymodelStr)

This works, but I think I shouldn't need to split a string. Perhaps at some 
moment the content_type will actually return a model and this string split 
hack is going to fall apart.

Any ideas?

Many thanks!

Adam

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6f9bc42d-1a01-4b2b-9afc-7157cd1b1f0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


active/alive Calendar app options for Django

2014-05-08 Thread Adam Teale
Hi guys,

Quick question, anyone using or know of a calendar app that is currently in 
active development that i could use in my django app?

I've been trying to get django-swingtime and django_bootstrap_calendar but 
i've got errors that i can't seem to resolve and i think their dev on 
github might not be very active.

Ideally i'd like to implement something as cool as iCal / Google calendar - 
with dragable objects to set the start and end times

Thanks for any tips!

Adam

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/94bc7f15-97f2-425f-8c43-1c1719518133%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: active/alive Calendar app options for Django

2014-05-09 Thread Adam Teale
Thanks for confirming that django_bootstrap_calendar is going well, I have
it installed and just got some feedback on github with a problem i had,
so fingers crossed I can get it to work.
Much appreciated!

Adam


On Thu, May 8, 2014 at 9:34 PM, Venkatraman S  wrote:

>
>
> On Fri, May 9, 2014 at 1:55 AM, Adam Teale  wrote:
>
>> Hi guys,
>>
>> Quick question, anyone using or know of a calendar app that is currently
>> in active development that i could use in my django app?
>>
>> I've been trying to get django-swingtime and django_bootstrap_calendar
>> but i've got errors that i can't seem to resolve and i think their dev on
>> github might not be very active.
>>
>> Ideally i'd like to implement something as cool as iCal / Google calendar
>> - with dragable objects to set the start and end times
>>
>>
> I use django_bootstrap_calendar and it works absolutely fine for me. There
> are some bugs in the week and date views and I need to merge them asap -
> probably this weekend.
>
> Also, if you find any other bugs in  django_bootstrap_calendar, do mention
> in issues - the dev atleast replies back.
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/rE6VTC2QCyQ/unsubscribe.
> To unsubscribe from this group and all its topics, 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAN7tdFTQLNSH%3D2xF4fFhNyf4opQmaquHpFmLhVY54_P-ws5%2BYA%40mail.gmail.com<https://groups.google.com/d/msgid/django-users/CAN7tdFTQLNSH%3D2xF4fFhNyf4opQmaquHpFmLhVY54_P-ws5%2BYA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMse0ZgRMXEkX_kY8PUX6mE22km%2BXR%3D1EbFWFSmpdGBeoUXHLw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: active/alive Calendar app options for Django

2014-05-09 Thread Adam Teale
Well it looks like I am not getting any errors! Great, and I can see the
calendar controls.
But no calendar!
Do I need to create my own calendar model - Event, EventType.. etc? And
plug that into the bootstrap_calendar.
I think I'm missing a rather important piece in the puzzle.  If you have
tips I'd really appreciate hearing them if you have the time.
Cheers!


On Fri, May 9, 2014 at 9:51 AM, Adam Teale  wrote:

> Thanks for confirming that django_bootstrap_calendar is going well, I
> have it installed and just got some feedback on github with a problem i
> had, so fingers crossed I can get it to work.
> Much appreciated!
>
> Adam
>
>
> On Thu, May 8, 2014 at 9:34 PM, Venkatraman S  wrote:
>
>>
>>
>> On Fri, May 9, 2014 at 1:55 AM, Adam Teale  wrote:
>>
>>> Hi guys,
>>>
>>> Quick question, anyone using or know of a calendar app that is currently
>>> in active development that i could use in my django app?
>>>
>>> I've been trying to get django-swingtime and django_bootstrap_calendar
>>> but i've got errors that i can't seem to resolve and i think their dev on
>>> github might not be very active.
>>>
>>> Ideally i'd like to implement something as cool as iCal / Google
>>> calendar - with dragable objects to set the start and end times
>>>
>>>
>> I use django_bootstrap_calendar and it works absolutely fine for me.
>> There are some bugs in the week and date views and I need to merge them
>> asap - probably this weekend.
>>
>> Also, if you find any other bugs in  django_bootstrap_calendar, do
>> mention in issues - the dev atleast replies back.
>>
>>  --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/rE6VTC2QCyQ/unsubscribe.
>> To unsubscribe from this group and all its topics, 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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAN7tdFTQLNSH%3D2xF4fFhNyf4opQmaquHpFmLhVY54_P-ws5%2BYA%40mail.gmail.com<https://groups.google.com/d/msgid/django-users/CAN7tdFTQLNSH%3D2xF4fFhNyf4opQmaquHpFmLhVY54_P-ws5%2BYA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMse0Zg1JC_FzqAkCBA%2BwQNnnfx0Hff9SRh6ae-BowzX8iaMkg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: active/alive Calendar app options for Django

2014-05-09 Thread Adam Teale
Thanks a lot for taking the time to write back to me, I am very thankful.

If you don't mind would you be able to give me a few more pointers?
I can't see the calendar app in admin - do I need to add in to the admin.py
file?

And I am getting browser errors related to the static files - should I copy
these into my static folder or will these be read from the
django_bootstrap_calendar app's static folder.

Perhaps I should drop these questions onto the github page




On Fri, May 9, 2014 at 9:58 AM, Venkatraman S  wrote:

>
> On Fri, May 9, 2014 at 7:26 PM, Adam Teale  wrote:
>
>> Well it looks like I am not getting any errors! Great, and I can see the
>> calendar controls.
>> But no calendar!
>> Do I need to create my own calendar model - Event, EventType.. etc? And
>> plug that into the bootstrap_calendar.
>> I think I'm missing a rather important piece in the puzzle.  If you have
>> tips I'd really appreciate hearing them if you have the time.
>>
>
> Add some content into the model via admin - it will show up.
> I would highly recommend going through the app's code so that you know how
> the different pieces in the 'puzzle' work in tandem and what you need to
> customize it.
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/rE6VTC2QCyQ/unsubscribe.
> To unsubscribe from this group and all its topics, 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAN7tdFQ0p2USK3ucBd1%3DAZ6vq%3D3ui9XoWUKu_JxeQWPffRbpEQ%40mail.gmail.com<https://groups.google.com/d/msgid/django-users/CAN7tdFQ0p2USK3ucBd1%3DAZ6vq%3D3ui9XoWUKu_JxeQWPffRbpEQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMse0ZhtOQ_vc%2BJ1AhKmu6JNsC0u3edbe7mgMCOUT9y8MPCh5w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


safari ios 7 and django app - function not being called to serve video

2014-06-03 Thread Adam Teale
Hi Guys,

I am in the process of building a web app with django.
The app is running on apache and files/videos are served with the xsendfile 
apache module.
The app is working fine on iphones, ipads and macs on the local network - 
when I access the site via a url like https://myapp.local

When I visit the app through it's real world domain (https://myapp.com) via 
a computer everything is ok too.
But when on the iPhone/ipad the videos do not get loaded. The custom url I 
have made for serving the videos isn't even called.

I am embedding the videos like this:


So the url is called to grab that asset and return the file response with 
the path.
This 'serveAsset' doesn't get called from the iPhone/iPad.
When I hit that url directly the video doesn't load either.
(But it does from a mac and safari - including using the "Safari iOS7 - 
iPhone" User agent.

Does Safari iOS7 not work with urls that serve material for the page?

Any ideas what might be going on?

Any help would be very much appreciated!

Cheers

Adam

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/62927890-40aa-47d6-84cb-0c26bd5285f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: safari ios 7 and django app - function not being called to serve video

2014-06-05 Thread Adam Teale
Thanks for your suggestions Ilya.

>From the apache side of things my serveAsset function is not called when
the page is viewed from an iPhone/iPad. But it works fine from a browser on
a computer.

I changed to using the URL tag.

I really can't work it out at the moment.
I wonder if it is some configuration on the mac os x server that is running
the django app related to mobile devices?


On Thu, Jun 5, 2014 at 9:16 AM, Ilya Kazakevich <
ilya.kazakev...@jetbrains.com> wrote:

> Hello,
>
> 1) Use FireBug (
> http://www.hongkiat.com/blog/installing-firebug-browsers-ios/) to check
> generated HTML for correct link and HTTP request your browser sends/receives
> 2) Check your web server logs to ensure Safari tries to load video (you
> need access log and error log I believe:
> http://httpd.apache.org/docs/2.2/logs.html )
> 3) NEVER hardcode urls! Use URL tag (
> https://docs.djangoproject.com/en/dev/ref/templates/builtins/#url)
>
>
> Ilya Kazakevich,
> JetBrains PyCharm (Best Python/Django IDE)
> http://www.jetbrains.com/pycharm/
> "Develop with pleasure!"
>
>
> >-Original Message-
> >From: django-users@googlegroups.com
> >[mailto:django-users@googlegroups.com] On Behalf Of Adam Teale
> >Sent: Wednesday, June 04, 2014 1:21 AM
> >To: django-users@googlegroups.com
> >Subject: safari ios 7 and django app - function not being called to serve
> video
> >
> >Hi Guys,
> >
> >I am in the process of building a web app with django.
> >The app is running on apache and files/videos are served with the
> xsendfile
> >apache module.
> >The app is working fine on iphones, ipads and macs on the local network -
> when I
> >access the site via a url like https://myapp.local
> >
> >When I visit the app through it's real world domain (https://myapp.com)
> via a
> >computer everything is ok too.
> >But when on the iPhone/ipad the videos do not get loaded. The custom url
> I have
> >made for serving the videos isn't even called.
> >
> >I am embedding the videos like this:
> > >preload="metadata" autostart="False" controls>
> >
> >So the url is called to grab that asset and return the file response with
> the path.
> >This 'serveAsset' doesn't get called from the iPhone/iPad.
> >When I hit that url directly the video doesn't load either.
> >(But it does from a mac and safari - including using the "Safari iOS7 -
> iPhone" User
> >agent.
> >
> >Does Safari iOS7 not work with urls that serve material for the page?
> >
> >Any ideas what might be going on?
> >
> >Any help would be very much appreciated!
> >
> >Cheers
> >
> >Adam
> >
> >--
> >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 http://groups.google.com/group/django-users.
> >To view this discussion on the web visit
> >https://groups.google.com/d/msgid/django-users/62927890-40aa-47d6-84cb-0c
> >26bd5285f6%40googlegroups.com
> ><https://groups.google.com/d/msgid/django-users/62927890-40aa-47d6-84cb-0
> >c26bd5285f6%40googlegroups.com?utm_medium=email&utm_source=footer> .
> >For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/u_zJ8Pc4Eyg/unsubscribe.
> To unsubscribe from this group and all its topics, 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/048d01cf80c0%246852d990%2438f88cb0%24%40JetBrains.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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMse0ZjOkfqD%2BAp2z_asTFo1ekYbKc_c79B3k0QhN9hCOKMdkw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: safari ios 7 and django app - function not being called to serve video

2014-06-05 Thread Adam Teale
Ahh i just worked out the issue.

The server is using SSL certification (https?) and for some reason on the
iphone/ipad the serveAsset was not being called.

So now to work out how to call the URL tag with SSL.

Cheers!


On Thu, Jun 5, 2014 at 10:33 AM, Adam Teale  wrote:

> Thanks for your suggestions Ilya.
>
> From the apache side of things my serveAsset function is not called when
> the page is viewed from an iPhone/iPad. But it works fine from a browser on
> a computer.
>
> I changed to using the URL tag.
>
> I really can't work it out at the moment.
> I wonder if it is some configuration on the mac os x server that is
> running the django app related to mobile devices?
>
>
> On Thu, Jun 5, 2014 at 9:16 AM, Ilya Kazakevich <
> ilya.kazakev...@jetbrains.com> wrote:
>
>> Hello,
>>
>> 1) Use FireBug (
>> http://www.hongkiat.com/blog/installing-firebug-browsers-ios/) to check
>> generated HTML for correct link and HTTP request your browser sends/receives
>> 2) Check your web server logs to ensure Safari tries to load video (you
>> need access log and error log I believe:
>> http://httpd.apache.org/docs/2.2/logs.html )
>> 3) NEVER hardcode urls! Use URL tag (
>> https://docs.djangoproject.com/en/dev/ref/templates/builtins/#url)
>>
>>
>> Ilya Kazakevich,
>> JetBrains PyCharm (Best Python/Django IDE)
>> http://www.jetbrains.com/pycharm/
>> "Develop with pleasure!"
>>
>>
>> >-Original Message-
>> >From: django-users@googlegroups.com
>> >[mailto:django-users@googlegroups.com] On Behalf Of Adam Teale
>> >Sent: Wednesday, June 04, 2014 1:21 AM
>> >To: django-users@googlegroups.com
>> >Subject: safari ios 7 and django app - function not being called to
>> serve video
>> >
>> >Hi Guys,
>> >
>> >I am in the process of building a web app with django.
>> >The app is running on apache and files/videos are served with the
>> xsendfile
>> >apache module.
>> >The app is working fine on iphones, ipads and macs on the local network
>> - when I
>> >access the site via a url like https://myapp.local
>> >
>> >When I visit the app through it's real world domain (https://myapp.com)
>> via a
>> >computer everything is ok too.
>> >But when on the iPhone/ipad the videos do not get loaded. The custom url
>> I have
>> >made for serving the videos isn't even called.
>> >
>> >I am embedding the videos like this:
>> >> >preload="metadata" autostart="False" controls>
>> >
>> >So the url is called to grab that asset and return the file response
>> with the path.
>> >This 'serveAsset' doesn't get called from the iPhone/iPad.
>> >When I hit that url directly the video doesn't load either.
>> >(But it does from a mac and safari - including using the "Safari iOS7 -
>> iPhone" User
>> >agent.
>> >
>> >Does Safari iOS7 not work with urls that serve material for the page?
>> >
>> >Any ideas what might be going on?
>> >
>> >Any help would be very much appreciated!
>> >
>> >Cheers
>> >
>> >Adam
>> >
>> >--
>> >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 http://groups.google.com/group/django-users.
>> >To view this discussion on the web visit
>> >
>> https://groups.google.com/d/msgid/django-users/62927890-40aa-47d6-84cb-0c
>> >26bd5285f6%40googlegroups.com
>> ><
>> https://groups.google.com/d/msgid/django-users/62927890-40aa-47d6-84cb-0
>> >c26bd5285f6%40googlegroups.com?utm_medium=email&utm_source=footer> .
>> >For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/u_zJ8Pc4Eyg/unsubscribe.
>> To unsubscribe from this group and all its topics, 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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/048d01cf80c0%246852d990%2438f88cb0%24%40JetBrains.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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMse0ZiGOCoP5tHJoPQCQ5gDSMMkTknwA8hWnae_VqMqat78Eg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Running daphne in production - Mac OS X Server 10.11

2016-11-10 Thread Adam Teale
Hi everyone,

I am looking into Andrew Godwin's example project "channels-example" (
https://github.com/andrewgodwin/channels-examples).

The multichat demo runs fine using the development/localhost server and now
I am attempting to put it into production mode so I can access across our
network and test it out.

I have my own django app that I have running on Mac OS X server using the
Apache module mod_wsgi .
I have used this same setup to get the multi chat demo running.

I do understand that all http and web socket traffic can be handled by
Daphne and that it isn't necessary to run the app via WSGI.

I can access the multi chat app from a browser in another machine however
when it comes to the part of the the app connecting via web sockets I get
this error:


*WebSocket connection to 'wss://myexampleserver.local/chat/stream/'
failed: Unexpected response code: 404*

I have Daphne running like this:

daphne multichat.asgi:channel_layer


The terminal returns:

Starting server at 127.0.0.1:8000, channel layer
multichat.asgi:channel_layer

Using busy-loop synchronous mode on channel layer

The worker is running too via python manage.py runworker

My feeling is that I do not have Daphne configured properly to receive the
web socket connections from the appropriate port / IP address (it shouldn't
be localhost right?).

I hope that makes some sense and that someone might be able to shed some
light on what I have misunderstood.

Many thanks!

Adam

-- 
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/CAMse0ZhCxubi-EWgux9Xah%2BRd_JOSWHDW0HgqgvkZtWr%3DPkDAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Running daphne in production - Mac OS X Server 10.11

2016-11-10 Thread Adam Teale
Hi Andrew,

Thank you very much for you help.

Can you direct me to where I might be able to find some info about 
configuring Daphne for production? 

I've gone through what you have available on the Read the docs 
(https://channels.readthedocs.io/en/stable/deploying.html) however I think 
I need some more basic information on setting up the server itself so that 
Daphne is doing all the work - or perhaps I am missing something completely 
obvious here.

Thanks again Andrew!

Adam


On Thursday, 10 November 2016 17:33:32 UTC-3, Andrew Godwin wrote:
>
> Hi Adam,
>
> It looks like you're running the main site through mod_wsgi, which means 
> that it does not support WebSockets; daphne won't help as you're running it 
> on a different port. Either you need to access the whole site via Daphne, 
> or change the code so that it appends a different port to the WebSocket 
> source URL (by default it's trying the same port as the page it's served on)
>
> Andrew
>
> On Thu, Nov 10, 2016 at 12:24 PM, Adam Teale  > wrote:
>
>> Hi everyone,
>>
>> I am looking into Andrew Godwin's example project "channels-example" (
>> https://github.com/andrewgodwin/channels-examples).
>>
>> The multichat demo runs fine using the development/localhost server and 
>> now I am attempting to put it into production mode so I can access across 
>> our network and test it out.
>>
>> I have my own django app that I have running on Mac OS X server using the 
>> Apache module mod_wsgi .
>> I have used this same setup to get the multi chat demo running.
>>
>> I do understand that all http and web socket traffic can be handled by 
>> Daphne and that it isn't necessary to run the app via WSGI. 
>>
>> I can access the multi chat app from a browser in another machine however 
>> when it comes to the part of the the app connecting via web sockets I get 
>> this error:
>>
>>
>> *WebSocket connection to 'wss://myexampleserver.local/chat/stream/' 
>> failed: Unexpected response code: 404*
>>
>> I have Daphne running like this:
>>
>> daphne multichat.asgi:channel_layer
>>
>>
>> The terminal returns:
>>
>> Starting server at 127.0.0.1:8000, channel layer 
>> multichat.asgi:channel_layer
>>
>> Using busy-loop synchronous mode on channel layer
>>
>> The worker is running too via python manage.py runworker
>>
>> My feeling is that I do not have Daphne configured properly to receive 
>> the web socket connections from the appropriate port / IP address (it 
>> shouldn't be localhost right?).
>>
>> I hope that makes some sense and that someone might be able to shed some 
>> light on what I have misunderstood.
>>
>> Many thanks!
>>
>> Adam
>>
>>
>>
>> -- 
>> 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/CAMse0ZhCxubi-EWgux9Xah%2BRd_JOSWHDW0HgqgvkZtWr%3DPkDAg%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/django-users/CAMse0ZhCxubi-EWgux9Xah%2BRd_JOSWHDW0HgqgvkZtWr%3DPkDAg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> 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/a56a2f47-f081-4658-8bf7-88b184330b0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Running daphne in production - Mac OS X Server 10.11

2016-11-10 Thread Adam Teale
Ahhh great that's probably what I was misunderstanding - setting up Apache 
to proxy all requests to Daphne.

I'll look into this and post back to this thread just in case anyone else 
is in the same boat.

Cheers Andrew!

Adam


On Thursday, 10 November 2016 17:53:18 UTC-3, Andrew Godwin wrote:
>
> Hi Adam,
>
> That document is the totality of what I have personally written, so I 
> can't direct you to others. If we can work out what you're missing we can 
> add it.
>
> Basically, all you need to do is:
>
> * Run Daphne to listen on a port (8000 by default, but you can pick)
> * Make your frontend webserver (sounds like Apache for you) proxy all 
> requests to this port
> * Optionally: Make apache either proxy or use mod_wsgi based on path prefix
>
> Andrew
>
> On Thu, Nov 10, 2016 at 12:48 PM, Adam Teale  > wrote:
>
>> Hi Andrew,
>>
>> Thank you very much for you help.
>>
>> Can you direct me to where I might be able to find some info about 
>> configuring Daphne for production? 
>>
>> I've gone through what you have available on the Read the docs (
>> https://channels.readthedocs.io/en/stable/deploying.html) however I 
>> think I need some more basic information on setting up the server itself so 
>> that Daphne is doing all the work - or perhaps I am missing something 
>> completely obvious here.
>>
>> Thanks again Andrew!
>>
>> Adam
>>
>>
>> On Thursday, 10 November 2016 17:33:32 UTC-3, Andrew Godwin wrote:
>>>
>>> Hi Adam,
>>>
>>> It looks like you're running the main site through mod_wsgi, which means 
>>> that it does not support WebSockets; daphne won't help as you're running it 
>>> on a different port. Either you need to access the whole site via Daphne, 
>>> or change the code so that it appends a different port to the WebSocket 
>>> source URL (by default it's trying the same port as the page it's served on)
>>>
>>> Andrew
>>>
>>> On Thu, Nov 10, 2016 at 12:24 PM, Adam Teale  wrote:
>>>
>>>> Hi everyone,
>>>>
>>>> I am looking into Andrew Godwin's example project "channels-example" (
>>>> https://github.com/andrewgodwin/channels-examples).
>>>>
>>>> The multichat demo runs fine using the development/localhost server and 
>>>> now I am attempting to put it into production mode so I can access across 
>>>> our network and test it out.
>>>>
>>>> I have my own django app that I have running on Mac OS X server using 
>>>> the Apache module mod_wsgi .
>>>> I have used this same setup to get the multi chat demo running.
>>>>
>>>> I do understand that all http and web socket traffic can be handled by 
>>>> Daphne and that it isn't necessary to run the app via WSGI. 
>>>>
>>>> I can access the multi chat app from a browser in another machine 
>>>> however when it comes to the part of the the app connecting via web 
>>>> sockets 
>>>> I get this error:
>>>>
>>>>
>>>> *WebSocket connection to 'wss://myexampleserver.local/chat/stream/' 
>>>> failed: Unexpected response code: 404*
>>>>
>>>> I have Daphne running like this:
>>>>
>>>> daphne multichat.asgi:channel_layer
>>>>
>>>>
>>>> The terminal returns:
>>>>
>>>> Starting server at 127.0.0.1:8000, channel layer 
>>>> multichat.asgi:channel_layer
>>>>
>>>> Using busy-loop synchronous mode on channel layer
>>>>
>>>> The worker is running too via python manage.py runworker
>>>>
>>>> My feeling is that I do not have Daphne configured properly to receive 
>>>> the web socket connections from the appropriate port / IP address (it 
>>>> shouldn't be localhost right?).
>>>>
>>>> I hope that makes some sense and that someone might be able to shed 
>>>> some light on what I have misunderstood.
>>>>
>>>> Many thanks!
>>>>
>>>> Adam
>>>>
>>>>
>>>>
>>>> -- 
>>>> 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

Re: Running daphne in production - Mac OS X Server 10.11

2016-11-11 Thread Adam Teale
Hi Andrew,

I think I'm starting to get somewhere, I have edited one of the apache 
virtualhost conf files to include these lines:

ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/

Now when I access the server I am getting some feedback in the steel 
running the worker and the shell running Daphne

I continue to get the "Not Found: /chat/stream/" in the worker as well as 
this in the browser:

*WebSocket connection to 'ws://alfred.local/chat/stream/' failed: 
Unexpected response code: 404*

I'll keep looking. Cheers!

-- 
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/7bd016ff-c78f-47ee-a81d-dd7a60340e17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Running daphne in production - Mac OS X Server 10.11

2016-11-11 Thread Adam Teale
Also getting this error in the browser log:

WebSocket connection to 'ws://alfred.local/chat/stream/' failed: 
Unexpected response code: 503



On Friday, 11 November 2016 11:24:25 UTC-3, Adam Teale wrote:
>
> Hi Andrew,
>
> I think I'm starting to get somewhere, I have edited one of the apache 
> virtualhost conf files to include these lines:
>
> ProxyPass / http://127.0.0.1:8000/
> ProxyPassReverse / http://127.0.0.1:8000/
>
> Now when I access the server I am getting some feedback in the steel 
> running the worker and the shell running Daphne
>
> I continue to get the "Not Found: /chat/stream/" in the worker as well as 
> this in the browser:
>
> *WebSocket connection to 'ws://alfred.local/chat/stream/' failed: 
> Unexpected response code: 404*
>
> I'll keep looking. Cheers!
>
>

-- 
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/b1ef6181-5582-4c4c-bab1-f34b67560dca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Running daphne in production - Mac OS X Server 10.11

2016-11-11 Thread Adam Teale
I think my grief may be coming from connecting over https/SSL. 

When I run the worker with the -v 2 option it shows:

2016-11-11 14:55:43,446 - DEBUG - worker - Got message on http.request 
(reply http.response!EKDQPeJsDRwU)

2016-11-11 14:55:43,447 - DEBUG - runworker - http.request

2016-11-11 14:55:43,447 - DEBUG - worker - Dispatching message on 
http.request to channels.staticfiles.StaticFilesConsumer

Not Found: /chat/stream/

Any ideas?

-- 
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/9b3bc5d6-1927-4125-8d41-6ba43f1513ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Running daphne in production - Mac OS X Server 10.11

2016-11-11 Thread Adam Teale
I came across a post that suggested running Daphne like this:

daphne multichat.asgi:channel_layer --port 8000 -v 2


The updated error:


2016-11-11 15:43:14,453 DEBUGHTTP GET request for 
http.response!KwJtQDgmoifR

2016-11-11 15:43:14,478 DEBUGHTTP 404 response started for 
http.response!KwJtQDgmoifR

2016-11-11 15:43:14,478 DEBUGHTTP close for http.response!KwJtQDgmoifR

2016-11-11 15:43:14,478 DEBUGHTTP response complete for 
http.response!KwJtQDgmoifR

127.0.0.1:51749 - - [11/Nov/2016:15:43:14] "GET /chat/stream/" 404 2279


It seems the error is coming from not being able to locate the route/path 
"/chat/stream/"


-- 
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/527cb11e-d6f3-4c94-81ea-89d6038eb64c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Running daphne in production - Mac OS X Server 10.11

2016-11-14 Thread Adam Teale
Unfortunately I haven't had any luck with it.

I have the mod_proxy and mod_proxy_wstunnel Apache modules loaded and I the 
following proxies inside the virtual host for port 443 (SSL)

ProxyPass /chat/stream/ wss://127.0.0.1:8000/chat/stream/
ProxyPassReverse /chat/stream/ wss://127.0.0.1:8000/chat/stream/

ProxyPass /ws  ws://127.0.0.1:8000/
ProxyPassReverse /ws wss://127.0.0.1:8000/
ProxyPass /wss wss://127.0.0.1:8000/
ProxyPassReverse /wss wss://127.0.0.1:8000/


ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/


If anyone can shed some light on this or offer an opinion I'd really 
appreciate it.

Cheers

Adam

-- 
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/49d63ad3-41d8-4130-a78c-8f0f215992e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Channels - WebSocket connection to 'wss://mysite.local/chat/stream/' failed: WebSocket is closed before the connection is established. response code: 200

2016-12-22 Thread Adam Teale
Hi everyone,

I have a django app running on mac os x server via mod_wsgi (apache 2.4).

I am using proxypass to point to daphne (running on port 8000).

As far as I can tell things should be running ok. Daphne is being run via 
this command:

daphne mysite.asgi:channel_layer -v2 -p 8000

When ever I access the url with the Channels chat demo app (/chat) daphne 
prints the following:

2016-12-22 10:58:15,398 INFO Starting server at 127.0.0.1:8000, channel 
layer mysite.asgi:channel_layer

2016-12-22 10:58:15,400 INFO Using busy-loop synchronous mode on 
channel layer

2016-12-22 10:58:18,342 DEBUGHTTP GET request for 
http.response!SAKtXWGjqdCG

2016-12-22 10:58:18,373 DEBUGHTTP 200 response started for 
http.response!SAKtXWGjqdCG

2016-12-22 10:58:18,373 DEBUGHTTP close for http.response!SAKtXWGjqdCG

2016-12-22 10:58:18,374 DEBUGHTTP response complete for 
http.response!SAKtXWGjqdCG

127.0.0.1:49944 - - [22/Dec/2016:10:58:18] "GET /chat/" 200 6550

2016-12-22 10:58:18,440 DEBUGHTTP GET request for 
http.response!mDjckxncNYGS

2016-12-22 10:58:18,476 DEBUGHTTP 200 response started for 
http.response!mDjckxncNYGS

2016-12-22 10:58:18,477 DEBUGHTTP close for http.response!mDjckxncNYGS

2016-12-22 10:58:18,477 DEBUGHTTP response complete for 
http.response!mDjckxncNYGS

127.0.0.1:49950 - - [22/Dec/2016:10:58:18] "GET /chat/stream/" 200 6550

2016-12-22 10:58:19,527 DEBUGHTTP GET request for 
http.response!lCwBwWsyjxGf

2016-12-22 10:58:19,550 DEBUGHTTP 200 response started for 
http.response!lCwBwWsyjxGf

2016-12-22 10:58:19,551 DEBUGHTTP close for http.response!lCwBwWsyjxGf

2016-12-22 10:58:19,551 DEBUGHTTP response complete for 
http.response!lCwBwWsyjxGf

...




The rqworker also:


mysite.local

2016-12-22 10:58:31,984 - DEBUG - worker - Got message on http.request 
(reply http.response!MLkDhtLSmyEy)

2016-12-22 10:58:31,985 - DEBUG - runworker - http.request

2016-12-22 10:58:31,985 - DEBUG - worker - Dispatching message on 
http.request to channels.staticfiles.StaticFilesConsumer


The error I am getting in safari & chrome is:
"WebSocket connection to 'wss://mysite.local/chat/stream/' failed: 
WebSocket is closed before the connection is established. response code: 
200"


When I access the site on from the server via localhost:8000/chat 
everything works fine and daphne prints out:

2016-12-22 11:03:10,393 DEBUGHTTP GET request for 
http.response!MJBzHhZMRNnb

2016-12-22 11:03:10,406 DEBUGHTTP 200 response started for 
http.response!MJBzHhZMRNnb

2016-12-22 11:03:10,407 DEBUGHTTP close for http.response!MJBzHhZMRNnb

2016-12-22 11:03:10,407 DEBUGHTTP response complete for 
http.response!MJBzHhZMRNnb

127.0.0.1:50013 - - [22/Dec/2016:11:03:10] "GET /chat" 200 6550

2016-12-22 11:03:10,411 DEBUGWebSocket closed for 
websocket.send!wlxnNRjdYtZi

127.0.0.1:50026 - - [22/Dec/2016:11:03:10] "WSDISCONNECT /chat/stream/" - -

2016-12-22 11:03:10,413 DEBUGHTTP GET request for 
http.response!aGsxTkWhWXxh

2016-12-22 11:03:10,415 DEBUGHTTP GET request for 
http.response!fOyocApjCNFZ

2016-12-22 11:03:10,416 DEBUGHTTP GET request for 
http.response!EdzYIGSakoQB

2016-12-22 11:03:10,429 DEBUGHTTP 304 response started for 
http.response!fOyocApjCNFZ

2016-12-22 11:03:10,430 DEBUGHTTP close for http.response!fOyocApjCNFZ

2016-12-22 11:03:10,430 DEBUGHTTP response complete for 
http.response!fOyocApjCNFZ

127.0.0.1:50034 - - [22/Dec/2016:11:03:10] "GET /static/css/style_chat.css" 
304 -

2016-12-22 11:03:10,431 DEBUGHTTP 304 response started for 
http.response!EdzYIGSakoQB

2016-12-22 11:03:10,432 DEBUGHTTP close for http.response!EdzYIGSakoQB

2016-12-22 11:03:10,432 DEBUGHTTP response complete for 
http.response!EdzYIGSakoQB

127.0.0.1:50035 - - [22/Dec/2016:11:03:10] "GET 
/static/js/reconnecting-websocket.min.js" 304 -

2016-12-22 11:03:10,433 DEBUGHTTP 304 response started for 
http.response!aGsxTkWhWXxh

2016-12-22 11:03:10,433 DEBUGHTTP close for http.response!aGsxTkWhWXxh

2016-12-22 11:03:10,433 DEBUGHTTP response complete for 
http.response!aGsxTkWhWXxh

127.0.0.1:50013 - - [22/Dec/2016:11:03:10] "GET 
/static/js/jquery-1.12.2.min.js" 304 -

2016-12-22 11:03:10,446 DEBUGWebSocket open for 
websocket.send!GTaoMdCohNRJ

127.0.0.1:50038 - - [22/Dec/2016:11:03:10] "WSCONNECT /chat/stream/" - -

2016-12-22 11:03:10,447 DEBUGUpgraded connection 
http.response!uqNYcIilOUmR to WebSocket websocket.send!GTaoMdCohNRJ


And the rqworker

2016-12-22 11:03:43,757 - DEBUG - worker - Got message on http.request 
(reply http.response!lSnLnqtZGeAQ)

2016-12-22 11:03:43,758 - DEBUG - runworker - http.request

2016-12-22 11:03:43,758 - DEBUG - worker - Dispatching message on 
http.request to channels.staticfiles.StaticFilesConsumer

mysite.local

2016-12-22 11:03:43,775 - DEBUG - worker - Got message on 
websocket.disconnect (reply websocket.send!GTaoMdCohNRJ)

2016-12-22 11:03:43,775 - DEBUG -

Re: Django Channels - WebSocket connection to 'wss://mysite.local/chat/stream/' failed: WebSocket is closed before the connection is established. response code: 200

2016-12-22 Thread Adam Teale
I do have the mod_proxy_wstunnel module loaded.
I realised that I am getting an error in apache:

No protocol handler was valid for the URL /chat/stream/. If you are using a 
DSO version of mod_proxy, make sure the proxy submodules are included in 
the configuration using LoadModule.

I've tried a lot of the suggestions i've sound through google but nothing 
seems to work. Perhaps this Mac OS X Server.app Apache install has issues. 

Thanks anyway Andrew!



On Thursday, 22 December 2016 13:15:36 UTC-3, Andrew Godwin wrote:
>
> Apache's default mod_proxy does not support WebSockets. If you want to 
> keep using Apache I would consider looking at mod_proxy_wstunnel.
>
> Andrew
>
> On Thu, Dec 22, 2016 at 2:24 PM, Adam Teale  > wrote:
>
>> Hi everyone,
>>
>> I have a django app running on mac os x server via mod_wsgi (apache 2.4).
>>
>> I am using proxypass to point to daphne (running on port 8000).
>>
>> As far as I can tell things should be running ok. Daphne is being run via 
>> this command:
>>
>> daphne mysite.asgi:channel_layer -v2 -p 8000
>>
>> When ever I access the url with the Channels chat demo app (/chat) daphne 
>> prints the following:
>>
>> 2016-12-22 10:58:15,398 INFO Starting server at 127.0.0.1:8000, 
>> channel layer mysite.asgi:channel_layer
>>
>> 2016-12-22 10:58:15,400 INFO Using busy-loop synchronous mode on 
>> channel layer
>>
>> 2016-12-22 10:58:18,342 DEBUGHTTP GET request for 
>> http.response!SAKtXWGjqdCG
>>
>> 2016-12-22 10:58:18,373 DEBUGHTTP 200 response started for 
>> http.response!SAKtXWGjqdCG
>>
>> 2016-12-22 10:58:18,373 DEBUGHTTP close for http.response!SAKtXWGjqdCG
>>
>> 2016-12-22 10:58:18,374 DEBUGHTTP response complete for 
>> http.response!SAKtXWGjqdCG
>>
>> 127.0.0.1:49944 - - [22/Dec/2016:10:58:18] "GET /chat/" 200 6550
>>
>> 2016-12-22 10:58:18,440 DEBUGHTTP GET request for 
>> http.response!mDjckxncNYGS
>>
>> 2016-12-22 10:58:18,476 DEBUGHTTP 200 response started for 
>> http.response!mDjckxncNYGS
>>
>> 2016-12-22 10:58:18,477 DEBUGHTTP close for http.response!mDjckxncNYGS
>>
>> 2016-12-22 10:58:18,477 DEBUGHTTP response complete for 
>> http.response!mDjckxncNYGS
>>
>> 127.0.0.1:49950 - - [22/Dec/2016:10:58:18] "GET /chat/stream/" 200 6550
>>
>> 2016-12-22 10:58:19,527 DEBUGHTTP GET request for 
>> http.response!lCwBwWsyjxGf
>>
>> 2016-12-22 10:58:19,550 DEBUGHTTP 200 response started for 
>> http.response!lCwBwWsyjxGf
>>
>> 2016-12-22 10:58:19,551 DEBUGHTTP close for http.response!lCwBwWsyjxGf
>>
>> 2016-12-22 10:58:19,551 DEBUGHTTP response complete for 
>> http.response!lCwBwWsyjxGf
>>
>> ...
>>
>>
>>
>>
>> The rqworker also:
>>
>>
>> mysite.local
>>
>> 2016-12-22 10:58:31,984 - DEBUG - worker - Got message on http.request 
>> (reply http.response!MLkDhtLSmyEy)
>>
>> 2016-12-22 10:58:31,985 - DEBUG - runworker - http.request
>>
>> 2016-12-22 10:58:31,985 - DEBUG - worker - Dispatching message on 
>> http.request to channels.staticfiles.StaticFilesConsumer
>>
>>
>> The error I am getting in safari & chrome is:
>> "WebSocket connection to 'wss://mysite.local/chat/stream/' failed: 
>> WebSocket is closed before the connection is established. response code: 
>> 200"
>>
>>
>> When I access the site on from the server via localhost:8000/chat 
>> everything works fine and daphne prints out:
>>
>> 2016-12-22 11:03:10,393 DEBUGHTTP GET request for 
>> http.response!MJBzHhZMRNnb
>>
>> 2016-12-22 11:03:10,406 DEBUGHTTP 200 response started for 
>> http.response!MJBzHhZMRNnb
>>
>> 2016-12-22 11:03:10,407 DEBUGHTTP close for http.response!MJBzHhZMRNnb
>>
>> 2016-12-22 11:03:10,407 DEBUGHTTP response complete for 
>> http.response!MJBzHhZMRNnb
>>
>> 127.0.0.1:50013 - - [22/Dec/2016:11:03:10] "GET /chat" 200 6550
>>
>> 2016-12-22 11:03:10,411 DEBUGWebSocket closed for 
>> websocket.send!wlxnNRjdYtZi
>>
>> 127.0.0.1:50026 - - [22/Dec/2016:11:03:10] "WSDISCONNECT /chat/stream/" 
>> - -
>>
>> 2016-12-22 11:03:10,413 DEBUGHTTP GET request for 
>> http.response!aGsxTkWhWXxh
>>
>> 2016-12-22 11:03:10,415 DEBUGHTTP GET request for 
>> http.response!fOyocApjCNFZ
>>
>> 2016-12-22 11:03:10,416 DEBUGHTTP GET request for 
>> 

At last! Django Channels / web sockets running on MacOS Server 5.2 (Apache 2.4.23)

2017-01-12 Thread Adam Teale
In case someone finds themselves in a similar situation here is how I got 
​W
eb
​S
ocket connections working via Apache
​ in MacOS Server 5.2​
.
And the solution 
​i​
s simple.

---
*The short version:​*

​I use MacOS Server 5.2 (ships with Apache 2.4.23) to run a python Django 
application via the mod_wsgi module. 

I ha
d
 been trying to setup proxypass and wstunnel
​ in MacOS 10.12 & Server 5.2 to handle websocket connections via an ASGI 
interface server called Daphne running on localhost on port 8001.​

I wanted to reverse proxy any WebSocket connection to 
wss://myapp.local/chat/stream/ to ws://localhost:8001/chat/stream/

​From what I had read on all the forums and mailing lists that I had 
scoured was to simply make some proxypass definitions in the appropriate 
virtual host and make sure that the mod_proxy and mod_proxy_wstunnel 
modules were loaded and it would work.

Long story short - from what I understand all 
​of ​
this trouble came down to MacOS Server 5 and one major change:
"A single instance of httpd runs as a reverse proxy, called the Service 
Proxy, and several additional instances of httpd run behind that proxy to 
support specific HTTP-based services, including an instance for the 
Websites service."

All I need
​ed​
 to do
​ to proxy the websocket connection​
 was the following:

in:
/Library/Server/Web/Config/Proxy/apache_serviceproxy.conf

​Add
 (around line 297 (in the section about user websites, webdav):
   ProxyPass / http://localhost:8001/
   ProxyPassReverse / http://localhost:8001/

   RewriteEngine on
   RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
   RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
   RewriteRule .* ws://localhost:8001%{REQUEST_URI} [P]


​I then k
icked over the service proxy:
sudo launchctl unload -w 
/Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/com.apple.serviceproxy.plist
sudo launchctl load -w 
/Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/com.apple.serviceproxy.plist

​And the web socket connections ​were instantly working!


​*The long version:​ *

For many weeks I have been trying to get WebSocket connections functioning 
with Apache and Andrew Godwin's Django Channels 
 project in an app I am 
developing. 

Django Channels is "a project to make Django able to handle more than just 
plain HTTP requests, including WebSockets and HTTP2, as well as the ability 
to run code after a response has been sent for things like thumbnailing or 
background calculation."

My interest in Django Channels came from my requirement of a chat system in 
my webapp. After watching a several of Andrew's demos on youtube and having 
read through the docs and eventually installing Andrew's demo django 
channels  project I 
figured I would be able to get this working in production on our MacOS 
Server.

The current release of MacOS 10.12 and Server 5.2 ships with Apache 2.4.23. 
This comes with the necessary mod_proxy_wstunnel module to be able to proxy 
WebSocket connections (ws:// and secure wss://) in Apache and is already 
loaded in the server config file:


/Library/Server/Web/Config/apache2/httpd_server_app.conf


Daphne 
 is 
Andrew's ASGI interface server that supports WebSockets & long-poll HTTP 
requests. WSGI does not.


With Daphne running on localhost on a port that MacOS isn't occupying (i 
went with 8001) the idea was to get Apache to reverse proxy certain 
requests to Daphne. 

Daphne can be run on a specified port (8001 in tis example) like so (-v2 
for more feedback):
daphne -p 8001 yourapp -v2

I wanted Daphne to handle only the web socket connections (as I use 
currently depend on some apache modules for serving media such as 
mod_xsendfile). In my case the websocket connection was via /chat/stream/ 
based on Andrew's demo project.

>From what I had read in MacOS Server's implementation of Apache the idea is 
to declare these proxypass commands inside the virtual host files of your 
"sites" in:
/Library/Server/Web/Config/apache2/sites/
In config files such as:
_127.0.0.1_34543_.conf
I did also read that any customisation for web apps running on MacOS Server 
should be made to the plist file for the required web app in:
/Library/Server/Web/Config/apache2/webapps/
In a plist file such as:
com.apple.webapp.wsgi.plist 
Anyway...

I edited the _127.0.0.1_34543_.conf file adding:
   ProxyPass /chat/stream/ ws://localhost:8001/ 
   ProxyPassReverse /chat/stream/ ws://localhost:8001/ 


Eager to test out my first web socket chat connection I refreshed the page 
only to see an error printed in the apache log:

No protocol handler was valid for the URL /chat/stream/. If you are using a 
DSO version of mod_proxy, make sure the proxy submodules are in

Clone formset

2017-01-18 Thread Adam Teale
Hi everyone,

Is it possible to clone a formset (inlineformset_factory)?

I'm not sure what would be the correct way to do so.

I am able to clone the form by:

form = self.get_form(form_class)
form.instance.pk = None
form.instance.save()

When it comes to the formset I don't know the method.
I think I understand that it is the formset's management_form that I need 
to manipulate to set the foeignkey to the cloned form.pk

Any suggestions?

I hope my question makes some sense.

Thanks

Adam

-- 
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/4897cca2-acd9-4e21-bbc1-10746b84aa72%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.