Re: Lazy evaluation of django custom context processor in base.html

2019-06-10 Thread BIJAL MANIAR

Hi, 

Can anyone help with django custom context processors. Have written above 
custom context processor that retrieves a value from database. This value 
has to be available in all templates as I have to pass it in "custom 
dimension" to google analytics. Is there an efficient way to pass this 
value to templates without hitting database query on every hit.

Thanks,
Bijal

On Monday, April 15, 2019 at 6:35:15 PM UTC+5:30, BIJAL MANIAR wrote:
>
>
> Hi,
>
> Have created a custom context processor to retrieve extra user attribute 
> from custom UserData model. Passing this variable in "base.html" template 
> calls the custom context processor function on every request to render html 
> page. Since it is a database query, how to efficiently call custom context 
> processor in "base.html".
>
> custom_context_processor.py
> def global_settings_userrole(request):
> USERROLE = None
> if request.user.is_authenticated():
> u = 
> UserData.objects.filter(username=request.user.username).values('role').first()
> USERROLE = u['role']
> return {
> 'USERROLE': USERROLE
> }
>
>
>
>
>
> Thanks,
> Bijal
>

-- 
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/eae07c13-8658-49b9-a2ba-1ee9ab12c1f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Lazy evaluation of django custom context processor in base.html

2019-04-17 Thread BIJAL MANIAR

Hi,

Can anyone help on this. I want to pass value of "USERROLE" across all the 
django templates through "base.html". How to efficiently call custom 
context processor as it queries database for every page load.

Thanks,
Bijal 

On Monday, April 15, 2019 at 6:35:15 PM UTC+5:30, BIJAL MANIAR wrote:
>
>
> Hi,
>
> Have created a custom context processor to retrieve extra user attribute 
> from custom UserData model. Passing this variable in "base.html" template 
> calls the custom context processor function on every request to render html 
> page. Since it is a database query, how to efficiently call custom context 
> processor in "base.html".
>
> custom_context_processor.py
> def global_settings_userrole(request):
> USERROLE = None
> if request.user.is_authenticated():
> u = 
> UserData.objects.filter(username=request.user.username).values('role').first()
> USERROLE = u['role']
> return {
> 'USERROLE': USERROLE
> }
>
>
>
>
>
> Thanks,
> Bijal
>

-- 
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/c18cac8e-ad16-412e-a557-f1f97f06a12b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Lazy evaluation of django custom context processor in base.html

2019-04-15 Thread BIJAL MANIAR

Hi,

Have created a custom context processor to retrieve extra user attribute 
from custom UserData model. Passing this variable in "base.html" template 
calls the custom context processor function on every request to render html 
page. Since it is a database query, how to efficiently call custom context 
processor in "base.html".

custom_context_processor.py
def global_settings_userrole(request):
USERROLE = None
if request.user.is_authenticated():
u = 
UserData.objects.filter(username=request.user.username).values('role').first()
USERROLE = u['role']
return {
'USERROLE': USERROLE
}





Thanks,
Bijal

-- 
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/55ecb39c-94dc-4782-8c60-927af7d5af88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Rename column headers with python DictWriter

2019-03-15 Thread BIJAL MANIAR


Hi,

Using Python DictWriter can we rename the column names?

Need to rename headers in CSV file so that output looks like. Basically 
need to rename database fieldnames like emp_name, emp_role to 
Name,Designation:
*Name, Designation*
ABC, IT
DEF, Admin

I am using Python DictWriter in django view and below is the snippet:

def export_csv(request):
data = [
{'emp_name': 'ABC', 'emp_role': 'IT'},
{'emp_name': 'DEF', 'emp_role': 'Admin'}
]
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="export.csv"'

*fieldnames = ['emp_name', 'emp_role']*
writer = csv.DictWriter(response, fieldnames=fieldnames, 
extrasaction='ignore')
writer.writeheader()
for row in data:
writer.writerow(row)
return response



Thanks,

Bijal


-- 
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/3b805ab5-5214-4258-97e0-e7d2388baf21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django ORM queryset substring on a column

2019-01-04 Thread BIJAL MANIAR

Hello,

Can anyone please help with this.

Thanks,
Bijal

On Thursday, January 3, 2019 at 6:47:43 PM UTC+5:30, BIJAL MANIAR wrote:
>
>
> Hello,
>
> Consider below column in mysql table Employee. I need to write django orm 
> query for below mysql query.
> emp_number
> 4-DEF-A111
> 3-MNO-333
> 2-DEF-222
> 1-ABC-111
>
>
> Mysql query which splits by '-' and matches against last index.
> SELECT * from Employee WHERE substring_index(emp_number, '-', -1) = '111';
>
> I cannot write endswith on a column like below:
> Employee.objects.filter(emp_number__endswith='111').values('emp_number')
> This will return below 2 records:
> 4-DEF-A111
> 1-ABC-111
>
>  Any help would be appreciated. Thanks.
>
> -Bijal
>

-- 
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/a3535912-e7a6-46ed-8770-cb55d183a633%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django ORM queryset substring on a column

2019-01-03 Thread BIJAL MANIAR

Hello,

Consider below column in mysql table Employee. I need to write django orm 
query for below mysql query.
emp_number
4-DEF-A111
3-MNO-333
2-DEF-222
1-ABC-111


Mysql query which splits by '-' and matches against last index.
SELECT * from Employee WHERE substring_index(emp_number, '-', -1) = '111';

I cannot write endswith on a column like below:
Employee.objects.filter(emp_number__endswith='111').values('emp_number')
This will return below 2 records:
4-DEF-A111
1-ABC-111

 Any help would be appreciated. Thanks.

-Bijal

-- 
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/8998da5d-3e3b-4fcd-a675-e5fc01ab01e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Integrating Okta SAML2 with existing django web application

2018-05-07 Thread BIJAL MANIAR

Hi,

I want to integrate an existing django web application with Okta identity 
provider. I could find a couple of packages:
https://github.com/fangli/django-saml2-auth
https://github.com/MindPointGroup/django-saml2-pro-auth

Have started to use django-saml2-auth. Can we also configure advanced 
security issues like signatures and encryption with it. If anyone came 
across any other easy to use package, please let me know.

Thanks,
Bijal

-- 
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/b340babf-6d10-42d3-91fc-6ac077865562%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Convert Excel code to Python

2018-01-09 Thread BIJAL MANIAR

Hi,
Thanks all for reply.
Since it is an old application there is no documentation for it. I will 
have to do Reverse Engineering by looking at vbscript code and gathering 
requirements.
Total there are 40 screens. A single form has 20-30 input parameters to 
select from and generate output depending on that. There are validation for 
combination of few input parameters as well. I can code in python but want 
some suggestion on approach to be followed.

I know fully automated tools are not available. Has anyone used vb2py or 
any such libraries for such requirement and how accurate it was?

Thanks,
Bijal

On Tuesday, January 9, 2018 at 6:45:55 PM UTC+5:30, BIJAL MANIAR wrote:
>
>
> Hi,
>
> There is an old application in Excel where macros are coded in VBScript 
> and there is both frontend (forms) and backend in Excel. Need to replicate 
> it as a web application (Python, Django, React). From scratch, have to 
> build it in python.
> I have checked vb2py library is there for code conversion but it has 
> limitations. Can anyone please guide me if any tools are available to 
> convert code from vbscript to python? 
>
> Thanks,
> Bijal
>
>

-- 
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/69a6524b-ffbc-4c32-bba6-7c6e40746832%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Convert Excel code to Python

2018-01-09 Thread BIJAL MANIAR

Hi,

There is an old application in Excel where macros are coded in VBScript and 
there is both frontend (forms) and backend in Excel. Need to replicate it 
as a web application (Python, Django, React). From scratch, have to build 
it in python.
I have checked vb2py library is there for code conversion but it has 
limitations. Can anyone please guide me if any tools are available to 
convert code from vbscript to python? 

Thanks,
Bijal

-- 
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/01179ad1-41ae-4d05-bf65-3cb7bd43e53f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Enable https for a production django application

2017-12-04 Thread BIJAL MANIAR

Hey Jani,
Do we need to purchase SSL certificate? Any links on that would be helpful.

Thanks,
Bijal

On Monday, December 4, 2017 at 1:36:35 PM UTC+5:30, Jani Tiainen wrote:
>
> Hi,
>
> You just need to redirect (permanently) all traffic to port 80 to 443 in 
> your Apache config.
>
> On 4.12.2017 10.03, BIJAL MANIAR wrote:
>
>
> Hello,
> We need to enforce an https connection for production django application 
> running with apache and mod-wsgi. Can anyone please help me with what it 
> will take to implement this.
>
> Thanks,
> Bijal
> -- 
> 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/16075809-a4f6-4174-b9a3-a545ade434ef%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/16075809-a4f6-4174-b9a3-a545ade434ef%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> -- 
> Jani Tiainen
>
>

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


Enable https for a production django application

2017-12-04 Thread BIJAL MANIAR

Hello,
We need to enforce an https connection for production django application 
running with apache and mod-wsgi. Can anyone please help me with what it 
will take to implement this.

Thanks,
Bijal

-- 
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/16075809-a4f6-4174-b9a3-a545ade434ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Weird issue in outputting CSV files for downloading in django

2017-09-25 Thread BIJAL MANIAR

Hi,
I want my view to respond with a file for downloading, so that the browser 
pops up the download/file save dialog.
I am using the 'Content-Disposition' header to specify the name of the file.
When I use the django development server, it works perfectly fine in all 
browsers
When I run it on production with apache mod_wsgi python3.5, on *chrome *it 
gives *Failed - Network error*. It doesn't work on firefox and IE as well.
Any help would be appreciated.

def download_function():
filename = '/test/A.sv'
download_name = "example.csv"
with open(filename, 'r') as myfile:
response = HttpResponse(myfile, content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename=%s' % 
download_name
response['Content-Length'] = os.path.getsize(filename)
return response


Thanks,

Bijal


-- 
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/09e4a016-429c-4669-9846-ade530a139e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to install mod_wsgi after upgrading to python3.5 from python2.7

2017-09-15 Thread BIJAL MANIAR


Hi James,
Thanks for reply.

I read below commands to install for mod_wsgi from here - 
(https://modwsgi.readthedocs.io/en/develop/user-guides/quick-installation-guide.html)

tar xvfz mod_wsgi-X.Y.tar.gz
cd mod_wsgi-4.5.14
./configure  --with-apxs=/usr/sbin/apxs 
 --with-python=/usr/local/bin/python3
make
make install

Since I already had apache installed on Linux , I could locate apxs file
bash-4.1# locate apxs
/usr/local/apache2/bin/apxs

Can I install mod_wsgi at system level with this command for existing 
apache installation as an laternative to pip install mod_wsgi.
./configure  --with-apxs=/usr/local/apache2/bin/apxs 
 --with-python=/usr/local/bin/python3




On Friday, September 15, 2017 at 3:24:46 PM UTC+5:30, James Schneider wrote:
>
>
>
> On Sep 15, 2017 2:04 AM, "BIJAL MANIAR" > 
> wrote:
>
>
> Hi,
> I had a production application running with Python2.7 and Django1.11 
> through Apache and mod_wsgi.
> Now I have upgraded to Python3.5 and created virtual env. pip install 
> mod_wsgi is giving below error.
>
> (p3_venv) bash-4.1# pip install mod_wsgi
> Collecting mod_wsgi
>   Downloading mod_wsgi-4.5.18.tar.gz (2.5MB)
> Complete output from command python setup.py egg_info:
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/tmp/pip-build-_hbwnbp5/mod-wsgi/setup.py", line 164, in 
> 
> 'missing Apache httpd server packages.' % APXS)
> RuntimeError: The 'apxs' command appears not to be installed or is not 
> executable. Please check the list of prerequisites in the documentation for 
> this package and install any missing Apache httpd server packages.
>
>
> You're likely missing the development libraries needed to build Apache 
> itself. Mod_wsgi needs to link with those during it's installation process.
>
>
>
> Since mod_wsgi was already installed for Python2.7 how do I reinstall 
> mod_wsgi. Do I need to re install within virtual environment or at system 
> level. Any links/list of steps will be helpful.
> Any help would be appreciated.
>
>
> That is very dependent on your environment and how much control you want 
> over the patch and update process. You'll need to remove the 2.7 version of 
> mod_wsgi, or at the very least, prevent Apache from loading it. It cannot 
> be loaded at the same time as another mod_wsgi instance using a different 
> Python version.
>
> You'll need to either use your system package manager to install the py3 
> version of mod_wsgi and hope that it matches your python version, or build 
> it yourself (as you are trying to do) from a virtualenv that will run your 
> project. Once that completes, you'll need to point Apache at the new module 
> you've built. It's not necessarily trivial. Start with the official guide, 
> or look for one specific to your OS:
>
> https://modwsgi.readthedocs.io/en/develop/installation.html
>
> -James
>

-- 
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/829ac778-b997-445b-81ee-bf0104a76d44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to install mod_wsgi after upgrading to python3.5 from python2.7

2017-09-15 Thread BIJAL MANIAR

Hi,
I had a production application running with Python2.7 and Django1.11 
through Apache and mod_wsgi.
Now I have upgraded to Python3.5 and created virtual env. pip install 
mod_wsgi is giving below error.

(p3_venv) bash-4.1# pip install mod_wsgi
Collecting mod_wsgi
  Downloading mod_wsgi-4.5.18.tar.gz (2.5MB)
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "", line 1, in 
  File "/tmp/pip-build-_hbwnbp5/mod-wsgi/setup.py", line 164, in 

'missing Apache httpd server packages.' % APXS)
RuntimeError: The 'apxs' command appears not to be installed or is not 
executable. Please check the list of prerequisites in the documentation for 
this package and install any missing Apache httpd server packages.

Since mod_wsgi was already installed for Python2.7 how do I reinstall 
mod_wsgi. Do I need to re install within virtual environment or at system 
level. Any links/list of steps will be helpful.
Any help would be appreciated.

Thanks,
Bijal


-- 
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/99d60e0c-293c-486d-9e9d-2332ca8723b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Python 2 versus 3

2017-09-03 Thread BIJAL MANIAR

Hi,

I have current django application with django 1.11 and python 2.7.
Python 2.7 has support till 2020-01-01 and 3.5 has support till 2020-09-13.
I've been asked to upgrade to Python 3.5. My question is why is there a 
need to upgrade from 2.7 to 3.5 as EOL support for both of them is nearly 
the same. 
Should I invest time in upgrading to Python3.5 or not?
Which is the latest Python3 LTS version and its EOL support?

Any help would be appreciated.

Thanks,
Bijal

-- 
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/df3849b9-1b6a-4a68-b0b4-edbf816d5213%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deploy production django applications with Python2.7 and Python3.5 on same Apache web server

2017-08-28 Thread BIJAL MANIAR

I tried serving both Python2.7 and Python3.5 based django applications 
through same Apache and it did not work.
Getting below error:

Traceback (most recent call last):
  File "C:/virtualenvs/ecst_venv_D111P36A22M51\lib\site.py", line 67, in 

import os
  File "C:/virtualenvs/ecst_venv_D111P36A22M51\lib\os.py", line 409
yield from walk(new_path, topdown, onerror, followlinks)
 ^
SyntaxError: invalid syntax

Can anyone please confirm if there is an alternative to using different 
apache instances.

Thanks,
Bijal

On Monday, August 28, 2017 at 4:50:56 PM UTC+5:30, BIJAL MANIAR wrote:
>
>
> Hi,
>
> I have existing setup of django app within virtual env (Python 2.7, Django 
> 1.11), running on Apache2.2 on production environment.
> On the same server, I want to setup one more django app within virtual env 
> (Python 3.5, Django 1.11).
> How can we have two django apps with two different versions of Python 
> running on same Apache server?
>
> Found an alternative mod_wsgi-express. Below is the link
> http://blog.dscpl.com.au/2015/04/integrating-modwsgi-express-as-django.html
> Is it suitable for production environments and has a good community 
> support? Does it have any limitation?
>
> Please let me know if there are any other ways to achieve this.
>
> Any help would be appreciated.
>
> Thanks,
> Bijal
>

-- 
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/c32c92a2-a273-46ea-b190-fc63b4656c67%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deploy production django applications with Python2.7 and Python3.5 on same Apache web server

2017-08-28 Thread BIJAL MANIAR

Hi Andreas,
Thanks for the reply. I'll go through link shared by you. Just wanted to 
confirm just by some configuration changes in httpd.conf, will same apache 
work for multiple python versions.

I came across below lines by Graham Dumpleton:
So the basic limitation here is that the one running Apache instance can 
only handle either Python 2 or Python 3 code. This is because the Python 
interpreter itself is embedded inside of the Apache processes through 
indirect dynamic linking of the Python interpreter shared library when the 
mod_wsgi module is loaded into Apache. How library linking works means that 
it isn’t possible to load two different versions of the same dynamic shared 
library into the one process at the same time. 

The only solution therefore is to have two separate instances of Apache 
running, one for Python 2 and one for Python 3 code. 

Thanks,
Bijal

On Monday, August 28, 2017 at 4:56:41 PM UTC+5:30, Andréas Kühne wrote:
>
> Hi,
>
> I found this information that could be handy for setting up with multiple 
> environments and mod_wsgi. 
>
>
> http://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html
>
> I don't think you really need to use a different setup, just some 
> configuration in your httpd.conf file.
>
> Otherwise you could also use uwsgi - which can handle that sort of thing 
> easily.
>
> Regards,
>
> Andréas
>
> 2017-08-28 13:20 GMT+02:00 BIJAL MANIAR >:
>
>>
>> Hi,
>>
>> I have existing setup of django app within virtual env (Python 2.7, 
>> Django 1.11), running on Apache2.2 on production environment.
>> On the same server, I want to setup one more django app within virtual 
>> env (Python 3.5, Django 1.11).
>> How can we have two django apps with two different versions of Python 
>> running on same Apache server?
>>
>> Found an alternative mod_wsgi-express. Below is the link
>>
>> http://blog.dscpl.com.au/2015/04/integrating-modwsgi-express-as-django.html
>> Is it suitable for production environments and has a good community 
>> support? Does it have any limitation?
>>
>> Please let me know if there are any other ways to achieve this.
>>
>> Any help would be appreciated.
>>
>> Thanks,
>> Bijal
>>
>> -- 
>> 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/fadfffe1-4597-4e56-9f45-2fe1dcd59c55%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/fadfffe1-4597-4e56-9f45-2fe1dcd59c55%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 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/e24d24c1-d888-4b08-9402-40bddc625214%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Deploy production django applications with Python2.7 and Python3.5 on same Apache web server

2017-08-28 Thread BIJAL MANIAR

Hi,

I have existing setup of django app within virtual env (Python 2.7, Django 
1.11), running on Apache2.2 on production environment.
On the same server, I want to setup one more django app within virtual env 
(Python 3.5, Django 1.11).
How can we have two django apps with two different versions of Python 
running on same Apache server?

Found an alternative mod_wsgi-express. Below is the link
http://blog.dscpl.com.au/2015/04/integrating-modwsgi-express-as-django.html
Is it suitable for production environments and has a good community 
support? Does it have any limitation?

Please let me know if there are any other ways to achieve this.

Any help would be appreciated.

Thanks,
Bijal

-- 
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/fadfffe1-4597-4e56-9f45-2fe1dcd59c55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Align radio buttons horizontally in django 1.11

2017-04-19 Thread BIJAL MANIAR

Hi,

I'm trying to upgrade existing application from 1.4 to 1.11.
Below snippet of code to align radio buttons horizontally is working fine 
with django 1.4

from django.utils.safestring import mark_safe

class HorizontalRadioRenderer(forms.RadioSelect.renderer):
  def render(self):
return mark_safe(u'\n'.join([u'%s\n' % w for w in self]))


class ApprovalForm(forms.Form):
approval = forms.ChoiceField(choices=APPROVAL_CHOICES,
 initial=0,
 widget=forms.RadioSelect(renderer=HorizontalRadioRenderer),
 )

But getting below error with django 1.11. 
AttributeError: type object 'RadioSelect' has no attribute 'renderer'.
Is it due to introduction of template based widget rendering. Is there any 
link on how to implement it?

Any help would be appreciated. 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d389323e-3717-4819-914a-2b8cca751a1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Upgrade from django 1.4 to django 1.11

2017-03-07 Thread BIJAL MANIAR

Hi,

Currently we have an application built using django 1.4. 
As the latest LTS release is 1.11, we are planning to upgrade it to 1.11.

Which of the below 3 alternatives is a better option for django version 
upgrade.
1. Should we take it one release at a time? ie, Make the jump from 1.4 to 
1.5 first, then proceed to 1.6, and so on.
2. Upgrade directly to 1.11 
3. Upgrade only to LTS release ie, 1.4 to 1.8 to 1.11

What other things we should consider before upgrading eg, having testcases 
in place.
Any links/suggestions will be helpful. 

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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8a24c1d5-6dc5-4963-84de-4e67ffbf15fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.