Re: Python 2.7 + Django 1.4 + apache 2.4

2013-07-16 Thread Lukas Nemec

Take a look here:

https://nemec.lu/en/how-to/~django-nginx-uwsgi-ssl

It is not apache, but nginx + uwsgi app + django

wsgi.py is generated automatically by manage.py startproject

example is here:
https://github.com/lunemec/wysiwyg/blob/master/wysiwyg/wsgi.py

Note: this is the app that runs under the hood of http://nemec.lu
so it is working...



On 07/16/2013 01:59 PM, Robert Jonathan Šimon wrote:

I have one question what must be in wsgi.py?

Dne úterý, 16. července 2013 1:11:48 UTC+2 maiquel napsal(a):

How to set up django on Apache

I'm using django 1.4
and apache 2.4
and Python 2.7
My configuration is well

in httpd.conf

WSGIScriptAlias ​​/ C :/ xampp / htdocs / My_blog / My_blog / wsgi.py
WSGIPythonPath / C :/ xampp / htdocs / My_blog /



Order deny, allow
Allow from all



Does anyone know what is wrong?

--
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.
For more options, visit https://groups.google.com/groups/opt_out.




--
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: save data from html table

2013-07-16 Thread Lukas Nemec

That depends, you could use django.db models to access that table,
but that depends on the table - there is a ton of information on this 
subject here:


https://docs.djangoproject.com/en/dev/topics/db/models/

Or, you could write a custom SQL that would fetch exactly the data you 
want, and

save it in dict or list ... and you have this data inside view ...


On 07/16/2013 03:00 PM, Randa Hisham wrote:

if i have dynami table in my template contain data
wht is the best way to save this data from table to view

--
Randa Hesham
Software Developer

Twitter:@ro0oraa 
FaceBook:Randa Hisham 

ٍ
--
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.
For more options, visit https://groups.google.com/groups/opt_out.




--
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: save data from html table

2013-07-16 Thread Lukas Nemec
Alright, so you have some rendered table in template, and you want to 
get it back to view?

That is the other way around I'm afraid...

request
   |
DB -> model ->   urlconf - > view -> template -> response

this is how the django responds to request ...
so any data you want to have in view, you have to create in view

another way - but that is kind of a hack - is to render a template and 
send it
with redirect to another url where you can parse it in another view, but 
this is

super ugly, and don't know if it would work..

I'm sorry but I don't have enough information to tell you more ...

On 07/16/2013 03:07 PM, Randa Hisham wrote:

my problem not to save to database but is how to get data from template


On Tue, Jul 16, 2013 at 3:03 PM, Lukas Nemec <mailto:lu.ne...@gmail.com>> wrote:


That depends, you could use django.db models to access that table,
but that depends on the table - there is a ton of information on
this subject here:

https://docs.djangoproject.com/en/dev/topics/db/models/

Or, you could write a custom SQL that would fetch exactly the data
you want, and
save it in dict or list ... and you have this data inside view ...



On 07/16/2013 03:00 PM, Randa Hisham wrote:

if i have dynami table in my template contain data
wht is the best way to save this data from table to view

-- 
Randa Hesham

Software Developer

Twitter:@ro0oraa <http://twitter.com/#%21/ro0oraa>
FaceBook:Randa Hisham <http://www.facebook.com/Ro0oraaa>

ٍ
-- 
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
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to
django-users@googlegroups.com <mailto:django-users@googlegroups.com>.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




-- 
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
<mailto:django-users%2bunsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.





--
Randa Hesham
Software Developer

Twitter:@ro0oraa <http://twitter.com/#%21/ro0oraa>
FaceBook:Randa Hisham <http://www.facebook.com/Ro0oraaa>

ٍ
--
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.
For more options, visit https://groups.google.com/groups/opt_out.




--
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django template prints

2013-07-16 Thread Lukas Nemec

If you have some DB model where is the data saved, you can do this

from project.app.models import NameOfModel

# try this, but if it will not work, look at django models help
filtered_data = 
NameOfModel.objects.filter(job_id___gt=29).filter(job_id__lt=401)


for d in filtered_data:

print d   # this just prints it to stdout


If you want to make some printing app, I suggest creating simple 
template with only the data
you want printed, and create some view for it that would do something 
like I've written above

and just print it from browser ... easiest way

Lukas


On 07/17/2013 07:14 AM, Harjot Mann wrote:

In my project the lab reports, reciepts, and bills are made from html
templates but thse are not saved anywhere but now I need to take the
print outs of all the reports which are made till now for example form
job_id 30 to 400. I want to make function for this so that it can be
done in a one script. Anyone having idea that how can I do this?/

--
Harjot Kaur Mann
Blog: http://harjotmann.wordpress.com/



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: new user having trouble displaying images stored on local disk drive

2013-07-16 Thread Lukas Nemec

Hi,

You are not the first to have trouble when serving images from django's 
built-in server.

It is not only images, but all staticfiles.

I'd like to clarify your settings.py

The directory you have put in STATICFILES_DIRS will be available to 
django as /static/ in your web app, but you need to have


STATICFILES_FINDERS =

("django.contrib.staticfiles.finders.FileSystemFinder",
 "django.contrib.staticfiles.finders.AppDirectoriesFinder")


Also the django test server needs to have correct permissions to open 
and read that folder,
but when you go just to /static/, you will not see anything, it will not 
list the files, you need to specify exact name of the file.


Django help:
https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/

If this didn't help, try stackowerflow

Lukas


On 07/16/2013 07:09 PM, evh wrote:
Working in a Windows environment without a production server - 
everything on one machine for ease of development (or so I thought). 
 Can display images pulled from the web, but not any stored on local 
hard drive.  Some of the relevant items in my settings.py looks like 
this:

MEDIA_ROOT = 'C:/djcode/images/'
MEDIA_URL = 'C:/djcode/images/'
STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or 
"C:/www/django/static".

# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
"C:/djcode/images/"
)
Would appreciate any guidance or suggestions on what I am missing or 
doing incorrectly.  Thanks.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.




--
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: showing the checked item alone in template

2013-07-17 Thread Lukas Nemec

I meant like this:

views.py:

form = PersonActionsForm()

actions = form.fields['actions']

# set checked_choice to None
checked_choice = None

for choice in actions.choices:

# if choice.selected (confirm this against request.POST)
checked_choice = choice


return render_to_response('template.html', {'choice': checked_choice})


in your template.html:

# the data you want shown

# this should contain the selected choice
{{ choice }}


If you run into problems, try simulating this in ipython.
Or you can send dir(checked_choice) into the render_to_response 
function, instead

just checked_choice, this way you can see what data are you getting.

Also it is a good idea to have some print's in the view for debugging 
purposes, so you can see

exactly what is going on.


On 07/17/2013 12:29 PM, Sivaram R wrote:
Can you provide me a sample or related url for reference purpose.I 
don't know how to right custom templatetag for this.


Thanks

On Tuesday, July 16, 2013 11:54:17 AM UTC+5:30, Lukáš Němec wrote:

You should do something like this (I havent tried it but it should
work):

1. you are missing this in forms.py

class Meta:

model = Actions

2. then you can do this in your views:

form = PersonActionsForm()

actions = form.fields['actions']

for choice in actions.choices:

# do something - check if this was the selected choice from
db, or from POST data


And then you return this to your template and create custom html
tags for this...

Enjoy


Dne pondělí, 15. července 2013 16:16:43 UTC+2 Sivaram R napsal(a):

forms.py

|PERSON_ACTIONS=  (
 ('1',  '01.Allowed to rest and returned to class'),
 ('2',  '02.Contacted parents /guardians'),
 ('3',  '02a.- Unable to Contact'),
 ('4',  '02b.Unavailable - left message'),)

class  PersonActionsForm(forms.ModelForm):
action=  forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple(),  
choices=PERSON_ACTIONS,  required=False,  label=  u"Actions")|


models.py

|class  Actions(models.Model):
 reportperson=  models.ForeignKey(ReportPerson)
 action=   models.IntegerField('Action type')

template.html

||{{  actionform.as_p}}|

The PersonActionsForm contains the items with multichoice
checkbox. In report registration page,the user can select any
one or more item.The checked items are saved in models as
integer values.

Since i am rendering the whole form it is showing the entire
form with checked and unchecked item.

In print page,i want to show only the checked item alone
without checkbox.

How to do this in django.

Thanks



--
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.
For more options, visit https://groups.google.com/groups/opt_out.




--
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: multiple templates fro single view

2013-08-01 Thread Lukas Nemec

Well, after some consideration,

result of a view is rendered HTML page which you send to browser,

what do you mean by rendering multiple templates?
are you talking about template inheritance = one root template which all 
other templates use?


in that case, use {% extends 'root.html' %} tag,
or are you talking about splitting your big template into a few smaller?
in that cas, use {% include 'page.html' %} tag

for more information look here:
https://docs.djangoproject.com/en/dev/topics/templates/


Enjoy!
Lukas


On 08/01/2013 01:14 PM, Harjot Mann wrote:

In my project I have a view which renders to an html template but I
want to render two templates at the same time from one view. How ca I
do it??



--
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to display Chinese in django webpage

2013-08-01 Thread Lukas Nemec

Hi

I'd suggest you to contact the developers of Zinnia blog,
they should be able to help you easily

Cheers :)
Lukas

On 08/01/2013 10:50 AM, zhao yan wrote:

HELLO:
I am a new django user
I want to display Chinese in my webpage
but it can't

this is my settings.py:
-

TIME_ZONE = 'Asia/Shanghai'
USE_TZ = True
USE_I18N = True
USE_L10N = True
LANGUAGE_CODE = 'zh-cn'
LANGUAGES = (
('zh_CN', gettext('Simplified Chinese')),
('en', gettext('English')),
)
--
Additional, I using a app "zinnia", all file
are contained:".mo, .po"
When I run:python manage.py runserver
The webpage is always display English.

Is it something wrong in settings.py?

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com.

To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




--
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: multiple templates fro single view

2013-08-01 Thread Lukas Nemec

On 08/01/2013 03:04 PM, Harjot Mann wrote:

On Thu, Aug 1, 2013 at 6:10 PM, Lukas Nemec  wrote:

Well, after some consideration,

result of a view is rendered HTML page which you send to browser,

what do you mean by rendering multiple templates?
are you talking about template inheritance = one root template which all
other templates use?

in that case, use {% extends 'root.html' %} tag,
or are you talking about splitting your big template into a few smaller?
in that cas, use {% include 'page.html' %} tag

No, I didn;t mean that.
Actually I have a function in views.py file which is hitting an html
file like this:
"return render_to_response('tcc/suspence_bill.html', dict(\
 template.items() + tmp.items()), context_instance =
RequestContext(request))"
here I want to return two html templates from this function.


Hmm. ... alright, how exactly, you have 2 different templates and you 
want to pass context data to both of them, and just append those two 
resulting html together?


so just don't return it

do this:

first try it as debug

html1 = render_to_response(template1 rendering here)
html2 = render_to_response(template 2 rendering)

try to print
print html1
print html2 # so you know if it even is representable as text because of 
http headers etc..


return html1 # or whatever you want

try dir(html1) if it is not a string

or dig into django shortcuts
https://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render


Enjoy!
Lukas

--
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django for corporate web site

2013-08-06 Thread Lukas Nemec

Exactly, tell us what is required on the page..

If it is a simple informational website, with some content, you can 
either use django's staticpages, or some CMS


few examples:
https://www.django-cms.org/
https://github.com/lunemec/django-pages  # I use this to run my own website



On 08/06/2013 10:43 AM, Avraham Serour wrote:

what is a corporate site exactly?

from what I understand a lawyer office website is nothing more than a 
bunch of static pages, like a business card, you could use a cms, but 
you could just generate some static pages



On Tue, Aug 6, 2013 at 11:41 AM, Sithembewena Lloyd Dube 
mailto:zebr...@gmail.com>> wrote:


Hi Sean,

You definitely can do that in Django.


On Tue, Aug 6, 2013 at 6:18 AM, Mike Dewhirst
mailto:mi...@dewhirst.com.au>> wrote:

On 6/08/2013 2:07pm, sean chen wrote:

I need to build a site for a small law firm. I looked at
the poweredby
pages http://www.djangosites.org/, but I found it shows
sites for
different purposes and I did not find a good example site
for me to
spark my thoughts further.

I see there exists a focus area for e-commerce site at
https://www.djangopackages.com/grids/g/ecommerce/, is
there a focus area
for corporate websites?


What do they want?

Mike



Thanks,
Sean

--
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.
For more options, visit
https://groups.google.com/groups/opt_out.



-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.





-- 
Regards,

Sithu Lloyd Dube
-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.



--
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.
For more options, visit https://groups.google.com/groups/opt_out.




--
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: HttpResponse Video

2013-08-06 Thread Lukas Nemec

Well, this may not be the best idea

On a production server, you'd make it differently
Sure, you could do it this way, but Django should serve dynamic context, 
so unless you are rendering images on your machine, you should use 
Nginx, or apache to serve your images, aka. staticfiles/media


you'd just point your user to /static/image.jpeg
and apache/nginx would take care of the rest


here is a example django/nginx/uwsgi configuration that I use on my server

https://nemec.lu/en/how-to/~django-nginx-uwsgi-ssl


Enjoy!


On 08/06/2013 11:48 AM, Hélio Miranda wrote:

Hi
I have a doubt, to show a picture do this:
*return HttpResponse (photo, content_type = 'image / jpeg')*

And if I show you a video as you want to do? Someone can help me?
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com.

To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




--
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Graph in django

2013-08-06 Thread Lukas Nemec

In that case, create a model in models.py, that represents your plot data..

add some data ...
and in views filter some data from that model ..
pass them to matplotlib
render to image
and either send back a image, or save the image and render html with 
path to that image..


If you don't know how to do any of these things, I'd suggest you to read 
django tutorial

and then ask us a more specific question.


Enjoy!
Lukas

On 08/06/2013 07:30 AM, amanjot kaur wrote:

I am plotting a graph in django using matplotlib. I am entering all
the values manually but I want to fetch the values from database in
views.py.



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Can't run manage.py runserver (Django 1.5.1)

2013-08-06 Thread Lukas Nemec

+1

At least install some linux distro into VirtualBox, ... Ubuntu if you 
are beginner...


I have W8 on my main machine, but for gaming mainly, for any serious 
development get linux, on dualboot or vbox ... I tried to do it on 
Windows, but once you smell the ease of things in linux, you'll 
understand ..


Lukas


On 08/06/2013 03:20 PM, pa xapy wrote:

try to use linux.
running python on win is suffering
--
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.
For more options, visit https://groups.google.com/groups/opt_out.




--
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: deploy ?

2013-10-11 Thread Lukas Nemec
Why do you want apache? It is not as good as say Nginx with UWSGI or 
gunicorn...

And there is a lot of information about this. ..

http://nemec.lu/en/how-to#django-nginx-uwsgi-ssl

enjoy

On 10/11/2013 05:40 PM, Diogene Laerce wrote:
Actually the default django server works but I can't get apache to 
serve the

app ? Anyone ?




--
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/52583308.5060101%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: supervisor

2013-10-21 Thread Lukas Nemec

On 10/21/2013 02:35 PM, Diogene Laerce wrote:

Hi,

Anyone could share a good process control system software name to use
with uwsgi ? Apart from supervisor, I couldn't make it work :
- can't stop it only kill it
- bug on supervisorctl reload.. Even when using the last version.

Thank you


Hi,

I'm using supervisor without problems on debian..

the trick is to add supervisor command that specifically tells the 
program to NOT daemonize


[program:my_uwsgi]
command = /usr/local/bin/uwsgi -i /path/to/config.ini
autorestart = True
user = your_user

config.ini:
your standard uwsgi config, but NO daemonize=logfile path

that works perfectly

I'm reloading all the time ..

--
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/52651EA2.7000109%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: supervisor

2013-10-21 Thread Lukas Nemec

On 10/21/2013 02:51 PM, Diogene Laerce wrote:

Thanks for reply.

the trick is to add supervisor command that specifically tells the 
program to NOT daemonize


[program:my_uwsgi]
command = /usr/local/bin/uwsgi -i /path/to/config.ini
autorestart = True
user = your_user

config.ini:
your standard uwsgi config, but NO daemonize=logfile path

that works perfectly

I'm reloading all the time ..


That means that you need to reload for every change in the code 
source, doesn't it ?

There's no over way ?


Exactly, the uwsgi has no idea that you edited .py files, you need to 
reload it. although there is some feature like the django server of 
autoreload, but just to be safe, you should reload the uwsgi processes 
by hand. I think I even saw some plugin for supervisor that does this 
automatically, but I'm not sure...


Hoewer on a different note, you should have your dev code separated from 
production, so you don't change it that often that it would bother you 
to reload it :)


Lukas

--
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/52652245.9040600%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: IntegrityError

2014-03-28 Thread Lukas Nemec

You need to re-create your database.

Good way is to create a script that populates your DB with some test 
data, and drop DB after a major change, or when something breaks, and 
re-create it.


For now, you should try to create different DB (to preserve your data) 
and do

python manage.py syncdb


Lukas


On 03/28/2014 03:24 PM, Warren Jacobus wrote:

Hi,

I've been trying to create a simple flight booking system but seem to 
have trouble.


When trying to create a Flight object it says that aircraft_id may not 
be null
and when trying to set a Passenger object it says flight_id may not be 
null



Here is my models.py file

from django.db import models
  2 from django.utils import timezone
  3 import datetime
  4
 # Create your models here.
class Aircraft(models.Model):
   aircraft_model = models.CharField(max_length=30)
   aircraft_num_seats = models.IntegerField(default=50)
   available = models.BooleanField(default=False)
   def __unicode__(self):
   return "%s , %d , %s" % 
(self.aircraft_model,self.aircraft_num_seats,self.available)

class Passenger(models.Model):
   passenger_name = models.CharField(max_length=30,default="John")
   passenger_surname= models.CharField(max_length=30,default="Doe")
   def __unicode__(self):
   return "%s %s"% (self.passenger_name,self.passenger_surname)
class Flight(models.Model):
   aircraft = models.ForeignKey(Aircraft)
   passengers = models.ManyToManyField(Passenger)
   num_seat_available = models.IntegerField(default=50) # requires 
method to calculate this

   departFrom = models.CharField(max_length=50)
   departTo = models.CharField(max_length=50)
   departTime = models.DateTimeField(default=timezone.now())
   flight_duration = models.IntegerField(default=0) # requires method 
to calculate this

   arrival = models.DateTimeField(default = timezone.now())
   cancel_flight = models.BooleanField(default=False)
   def __unicode__(self):
  return "%s --> %s , %s --> %s" % 
(self.departFrom,self.departTo,str(self.departTime),str(self.arrival))


Thanks
--
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/edab5b92-756f-4c90-a26e-75cedbe7d2af%40googlegroups.com 
.

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


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/53358BDF.8050806%40gmail.com.
For more options, visit https://groups.google.com/d/optout.