Re: Create socket server in django

2011-09-21 Thread Micke
Wow. I will try, and if it works as you say, its wonderful! :)


On Sep 20, 12:26 pm, Thorsten Sanders 
wrote:
> import sys,os
>
> sys.path.append('/path/to/your/django_project')
> os.environ['DJANGO_SETTINGS_MODULE'] = 'your_settings_file'
>
> This works fine for a cronjob I created
>
> On 20.09.2011 10:48, Thomas Orozco wrote:
>
>
>
>
>
>
>
>
>
> > You just have to run your server as a daemon and use Django's
> > setup_environment so you can use the ORM to interact with your Django DB.
>
> > I can try and find the lines you need to do that if you can't find them.
>
> > Le 20 sept. 2011 09:08, "Micke"  > > a �crit :
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Create socket server in django

2011-09-20 Thread Preston Holmes


On Sep 20, 12:07 am, Micke  wrote:
> Thank you for your quick reply!
>
> My socket server is ready, but I dont know where to import it in
> django so it starts when django starts?

You are going to run your socket server in a different python process
than Django.  Django is based on more of a CGI request-response cycle
and doesn't mesh well with a socket server.

However you can access the DB and Django models from inside your
socket server.  Think about it as importing parts of Django in your
socket server, then serving views of that data from the Django process

-P

>
> br
> Mikael
>
> On Sep 19, 11:38 pm, Andy McKay 
> wrote:
>
>
>
> > You could write a Python process that starts up a Socket Server and imports
> > all the Django stuff, just like the current server does for HTTP. Then
> > there's no need to "send the data to django". Might help:
>
> >http://docs.python.org/library/socketserver.html
>
> > On Mon, Sep 19, 2011 at 2:00 PM, Micke  wrote:
> > > Hi,
> > > Im new to Django and need some help in the right direction.
>
> > > I will create a socket server, that should recive raw udp data and put
> > > it in a database. After that Django should present the data in a
> > > customized view.
>
> > > Is it possible to create the server in Django, like in the views file,
> > > so it starts up when django starts? So I can use the in data and use
> > > orm to put it in db. Or do I need to do a separate server, that sends
> > > data to django after it recieves it?
>
> > > Thanks
> > > Mikael
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Create socket server in django

2011-09-20 Thread Thorsten Sanders

import sys,os

sys.path.append('/path/to/your/django_project')
os.environ['DJANGO_SETTINGS_MODULE'] = 'your_settings_file'

This works fine for a cronjob I created

On 20.09.2011 10:48, Thomas Orozco wrote:


You just have to run your server as a daemon and use Django's 
setup_environment so you can use the ORM to interact with your Django DB.


I can try and find the lines you need to do that if you can't find them.

Le 20 sept. 2011 09:08, "Micke" > a écrit :

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Create socket server in django

2011-09-20 Thread Thomas Orozco
You just have to run your server as a daemon and use Django's
setup_environment so you can use the ORM to interact with your Django DB.

I can try and find the lines you need to do that if you can't find them.
Le 20 sept. 2011 09:08, "Micke"  a écrit :

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Create socket server in django

2011-09-20 Thread Micke
Thank you for your quick reply!

My socket server is ready, but I dont know where to import it in
django so it starts when django starts?

br
Mikael

On Sep 19, 11:38 pm, Andy McKay 
wrote:
> You could write a Python process that starts up a Socket Server and imports
> all the Django stuff, just like the current server does for HTTP. Then
> there's no need to "send the data to django". Might help:
>
> http://docs.python.org/library/socketserver.html
>
>
>
>
>
>
>
> On Mon, Sep 19, 2011 at 2:00 PM, Micke  wrote:
> > Hi,
> > Im new to Django and need some help in the right direction.
>
> > I will create a socket server, that should recive raw udp data and put
> > it in a database. After that Django should present the data in a
> > customized view.
>
> > Is it possible to create the server in Django, like in the views file,
> > so it starts up when django starts? So I can use the in data and use
> > orm to put it in db. Or do I need to do a separate server, that sends
> > data to django after it recieves it?
>
> > Thanks
> > Mikael
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Create socket server in django

2011-09-19 Thread Andy McKay
You could write a Python process that starts up a Socket Server and imports
all the Django stuff, just like the current server does for HTTP. Then
there's no need to "send the data to django". Might help:

http://docs.python.org/library/socketserver.html

On Mon, Sep 19, 2011 at 2:00 PM, Micke  wrote:

> Hi,
> Im new to Django and need some help in the right direction.
>
> I will create a socket server, that should recive raw udp data and put
> it in a database. After that Django should present the data in a
> customized view.
>
> Is it possible to create the server in Django, like in the views file,
> so it starts up when django starts? So I can use the in data and use
> orm to put it in db. Or do I need to do a separate server, that sends
> data to django after it recieves it?
>
>
> Thanks
> Mikael
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Create socket server in django

2011-09-19 Thread Micke
Hi,
Im new to Django and need some help in the right direction.

I will create a socket server, that should recive raw udp data and put
it in a database. After that Django should present the data in a
customized view.

Is it possible to create the server in Django, like in the views file,
so it starts up when django starts? So I can use the in data and use
orm to put it in db. Or do I need to do a separate server, that sends
data to django after it recieves it?


Thanks
Mikael

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.