Re: required help to save SECRET_KEY and Third party Private API key

2020-05-18 Thread Akshat Zala
You can refer the link below:

1. https://cloud.google.com/community/tutorials/secrets-manager-python 

On Tuesday, 19 May 2020 10:26:17 UTC+5:30, Anirudh choudhary wrote:
>
> Hello everyone 
>
> I am hosting my website on google cloud platform on Ubuntu VM instance. I 
> cannot find a way to set the environment variable in the machine 
>
> Like when I type on my local machine os.environ.get("SECRET_KEY") it give 
> me the key but when I type the same command on VM instance it shows me null 
>
> I have tried some method like to edit the 
> 1./etc/environment 
> 2.~/.bashrc 
> but none of the files is giving me the secret Key 
>
> waiting for expert answer 
>
> thankyou 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0e4dbe3c-7b38-4e61-8e64-f96dc2c44dd3%40googlegroups.com.


Re: required help to save SECRET_KEY and Third party Private API key

2020-05-18 Thread Akshat Zala
You need to save in ~/.profile 

On Tuesday, 19 May 2020 10:26:17 UTC+5:30, Anirudh choudhary wrote:
>
> Hello everyone 
>
> I am hosting my website on google cloud platform on Ubuntu VM instance. I 
> cannot find a way to set the environment variable in the machine 
>
> Like when I type on my local machine os.environ.get("SECRET_KEY") it give 
> me the key but when I type the same command on VM instance it shows me null 
>
> I have tried some method like to edit the 
> 1./etc/environment 
> 2.~/.bashrc 
> but none of the files is giving me the secret Key 
>
> waiting for expert answer 
>
> thankyou 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/106781aa-6795-4828-8cda-fc4c4000f9f6%40googlegroups.com.


Re: Django back button issue after log-out

2020-05-18 Thread Akshat Zala
In urls.py of the project directory:

path('login/', auth_views.LoginView.
as_view(template_name='users/login.html', redirect_authenticated_user=True),
name='login'),

On Monday, 17 December 2012 18:39:25 UTC+5:30, ke1g wrote:
>
>
>
> On Mon, Dec 17, 2012 at 5:14 AM, Ashish Sable  > wrote:
>
>>
>> I have written simple registration(login,logout) Django apps.
>>  when i click on logout and then back button from browser 
>> it shows me previous page. it should redirect me to login page. please 
>> help
>>
>>
>  The back button in your browser just shows you cached stuff.  It doesn't 
> contact the server, so there is nothing Django can do.
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/978e6ffa-582e-4af3-ae3a-8ceb39fa4c2d%40googlegroups.com.


required help to save SECRET_KEY and Third party Private API key

2020-05-18 Thread Anirudh choudhary
Hello everyone

I am hosting my website on google cloud platform on Ubuntu VM instance. I
cannot find a way to set the environment variable in the machine

Like when I type on my local machine os.environ.get("SECRET_KEY") it give
me the key but when I type the same command on VM instance it shows me null

I have tried some method like to edit the
1./etc/environment
2.~/.bashrc
but none of the files is giving me the secret Key

waiting for expert answer

thankyou

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL8_rkGKMhR-OVF4f_nC5dQHPShnkfRTLu9XgO%3D-0DwLfAup_g%40mail.gmail.com.


Re: PROBLEM WITH Multiple SETTINGS.PY FILE

2020-05-18 Thread chaitanya orakala
I tried that way, sir. but it's of no use. I don't know how to resolve
this issue. its been troubling me for 3 days now

On Mon, May 18, 2020 at 9:29 PM Mike Dewhirst  wrote:

> On 19/05/2020 11:10 am, chaitanya orakala wrote:
> > I am using Python 2.7
>
> It is possible you need a top line in the file like this ...
>
> from __future__ import absolute_import
>
> I haven't been following this thread so someone may have mentioned that
> already.
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/95afb956-98f8-6664-9107-d0935b75cf6c%40dewhirst.com.au
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPcTzRZHgBG1Q90Rk8VmNS%2ByzmQLd1bdq8ZPgA6A%2Bumsx4CGvw%40mail.gmail.com.


Getting HTTP 301 on static resources

2020-05-18 Thread jtaylor___
I'm setting up a Django instance running with gunicorn, behind Apache.  
Running on the server, the initial page comes up at http://server_host/dj/, 
but all the static resources give a Status Code "301 Moved Permanently".  
Here's an example URL: 
http://server_host/dj/static/app_name/bootstrap/css/app_name-bootstrap.min.css.

In PyCharm with "manage.py runserver", the initial page loads and the same 
static resource 
(http://127.0.0.1/static/app_name/bootstrap/css/app_name-bootstrap.min.css) 
loads fine.

I spent a while on Google, but I guess I don't know how to properly write 
the search to find a solution.  

Any suggestions?  TIA

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/46757a62-69d5-46fb-a259-23d92e796783%40googlegroups.com.


creating a utility script inside a django app; relative import woes

2020-05-18 Thread Jake Waxman
I'm a relatively new Django user.
I'm running into a problem related to relative imports.
I have a project and app set up the usual way

mysite
-- myapp
 __init__.py
 all the modules and templates in myapp including one that contains the 
definition of MyClass
-- mysite
 __init__py
 all of the other the standard stuff inside mysite

The project works.

I want to create a utility script that makes use of a module in myapp
I want to be able to run this utility script from the command line.

When I try to import MyClass from mymodule via 
from .mymodule import MyClass

I get 
ImportError: attempted relative import with no known parent package

If I leave out the dot before mymodule
I get the same error but for another module in myapp that mymodule tries to 
import,

I suspect I'm trying to do something I'm not supposed to do but don't know 
what.
If it helps, I'm doing this in vscode


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/68cd1977-b2bb-44e7-9b93-6d6a928764a5%40googlegroups.com.


Re: HOW TO PROTECT SOURCE CODE DEPLOYED TO A REMOTE SERVER

2020-05-18 Thread Sunday Iyanu Ajayi
I get your point but my solution is kind of a  SaaS Application. the client
wants to host it on his controlled server  and if they get the source code,
they can replicate, modify and maybe sell it.  Is there a way to host the
compiled file or lock the directory to the project.
*AJAYI Sunday *
(+234) 806 771 5394
*sunnexaj...@gmail.com *



On Mon, May 18, 2020 at 9:28 PM Jim Armstrong  wrote:

> When I work on client projects, I deploy to a test server that is under my
> control. Once the project is complete and they have paid the invoice, I
> deploy to the production server under their control. At that point, I don't
> care if they have access to the code - my contracts give the clients all
> rights to the project code upon completion of the project.
>
>
> On Friday, May 15, 2020 at 9:22:33 AM UTC-4, Sunday Iyanu Ajayi wrote:
>>
>> I am working for a client that wants to deploy a project I am working on
>> in a remote server and I will like to project my source code when deployed
>> so that they will not be able to mess with it.
>>
>> How can  I  go about it please?
>>
>> *AJAYI Sunday *
>> (+234) 806 771 5394
>> *sunne...@gmail.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/636f0636-30df-4ce2-8629-2be8b208ec37%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKYSAw3Hqjuz5rD_AsZ5Wa%2B3WBzQ9LN0GzZKHx3D-irztJ1G0A%40mail.gmail.com.


Re: PROBLEM WITH Multiple SETTINGS.PY FILE

2020-05-18 Thread Mike Dewhirst

On 19/05/2020 11:10 am, chaitanya orakala wrote:
I am using Python 2.7 


It is possible you need a top line in the file like this ...

from __future__ import absolute_import

I haven't been following this thread so someone may have mentioned that 
already.



--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/95afb956-98f8-6664-9107-d0935b75cf6c%40dewhirst.com.au.


Re: PROBLEM WITH Multiple SETTINGS.PY FILE

2020-05-18 Thread chaitanya orakala
hey could anyone help with this?

On Mon, May 18, 2020 at 2:44 PM chaitanya orakala 
wrote:

> Hi Jorge,
> I tried placing a dot in front of settings_dev_sai, it didn't work. by the
> way, I am using Python 2.7 and Django 1.10 versions.
> [image: image.png]
> this is my project structure.  I am using a virtual environment.
> Please let me know what you think sir
>
> On Sat, May 16, 2020 at 7:54 PM Jorge Gimeno  wrote:
>
>> It's coming from your settings file.  I would try this:
>>
>> In this line here:
>> elif HOST == "Sai" :
>> from settings_dev_sai import *
>>
>> I would try to make the second line:
>> from .settings_dev_sai import *
>>
>> See if Python can find the module that way.  If Python does, then all of
>> the imports in that file need to be changed.
>>
>> If that's not the case, then we need to see what the directory structure
>> looks like to figure this out.
>>
>> -Jorge
>>
>> On Sat, May 16, 2020 at 4:04 PM chaitanya orakala <
>> chaitu.orak...@gmail.com> wrote:
>>
>>> Do you have any idea why i am getting this error?
>>>
>>> On Sat, May 16, 2020 at 6:40 PM chaitanya orakala <
>>> chaitu.orak...@gmail.com> wrote:
>>>
 Yes Jorge, all the settings file are in the same folder


 On Sat, May 16, 2020 at 5:20 PM Jorge Gimeno 
 wrote:

>
>
> On Sat, May 16, 2020 at 1:52 PM chaitan 
> wrote:
>
>> Hi, I am facing ModuleNotFoundError in my Django application. It got
>> configured with multiple settings files for production, Development &
>> Testing.
>> When I Try to run Python manage.py runserver --settings=
>> settings_dev_sai.
>>
>> This is My *Settings* File:
>>
>> import socket
>>
>> #import settings depending on the box we are on
>> HOST = socket.gethostname()
>> TPA_CODE = "Bridge"
>> TPA_NAME = "Bridge Benefits System"
>>
>> #development
>> if HOST == "BITS-DP-LAPTOP":
>> from settings_dev import *
>> TPA_NAME = "ICBA Benefit Services Ltd."
>> TPA_CODE = 'ICBA'
>> #DFG bridge
>> elif HOST == "dfginternal":
>> from settings_dfg_ees import *
>> TPA_NAME = "Dehoney Financial Group"
>> TPA_CODE = 'DFG'
>> #test
>> elif HOST == "DFGTEST02":
>> from settings_staging import *
>> elif HOST == "icbaweb":
>> from settings_production_icba import *
>> TPA_NAME = "ICBA Benefit Services Ltd."
>> TPA_CODE = 'ICBA'
>> elif HOST == "meritweb":
>> from settings_production_merit import *
>> TPA_NAME = "Ontario Construction Industry Benefit Plan"
>> TPA_CODE = 'MERIT'
>> elif HOST == "dfgweb" :
>> from settings_production_dfg import *
>> TPA_NAME = "Dehoney Financial Group"
>> TPA_CODE = 'DFG'
>> elif HOST == "dev" or HOST == "j-ubu" :
>> from settings_dev_baikal import *
>> elif HOST == "jdev" :
>> from settings_dev_juliab import *
>> elif HOST == "Sai" :
>> from settings_dev_sai import *
>> elif HOST == "johnstonesweb" :
>> from settings_production_johnstones import *
>> TPA_NAME = "Johnstone's Benefits"
>> TPA_CODE = 'JOHNSTONES'
>> elif HOST == "bridgedemo" :
>> from settings_demo import *
>> TPA_CODE = "Bridge"
>> TPA_NAME = "Bridge Benefits System"
>> else:
>> raise ImportError("This server's hostname [" + HOST + "] does not
>> have a proper expanded settings file. Please configure one.")
>> *
>>
>> This is my *settings_dev_sai*
>>
>> from settings_common import *
>>
>> DEBUG = True
>> RUN_TYPE = RUN_DEV
>>
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.postgresql_psycopg2',
>> #'NAME': 'bridge_icba',
>> 'NAME': 'bridge_js',
>> #'NAME': 'bridge_dfg_internal',
>> #'NAME': 'bridge_dfg',
>> 'HOST': 'localhost',
>> 'USER': 'django',
>> 'PASSWORD': 'bridge_user',
>> 'PORT': '',
>> },
>> }
>>
>> MEDIA_ROOT = 'C:/Users/DavidPiccione/Dropbox/Work -
>> Bridge/Projects/bridge/MEDIA/'
>> MEDIA_URL = '/media/'
>>
>> EMAIL_HOST = 'smtp.gmail.com'
>> EMAIL_PORT = 587
>> EMAIL_HOST_USER = 'bridgeautomaticmessen...@gmail.com'
>> EMAIL_HOST_PASSWORD = 'bridgeautomaticmessenger123'
>> EMAIL_USE_TLS = True
>> DEFAULT_FROM_EMAIL = 'bridgeautomaticmessen...@gmail.com'
>>
>>
>> STATIC_ROOT = ''
>> STATIC_URL = '/static/'
>> STATICFILES_DIRS = ("C:/Users/DavidPiccione/Dropbox/Work -
>> Bridge/Projects/bridge/static",)
>> STATIC_PATH = 'C:/Users/DavidPiccione/Dropbox/Work -
>> Bridge/Projects/bridge/static'
>>
>> TEMPLATES = [
>> {
>> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>> 'DIRS': 

Re: how to write Ajax for a Like button in Django

2020-05-18 Thread Ahmed Khairy
Hi Motaz,

I tried it again now but when I press it there is no change. The likes 
count is the same and the like button doesnt change to dislike

On Sunday, May 17, 2020 at 10:05:12 PM UTC-4, Motaz Hejaze wrote:
>
> The button is submitted but without page refresh
>
> On Mon, 18 May 2020, 3:53 am Ahmed Khairy,  > wrote:
>
>> Hi Motaz,
>>
>> When I added your code it disabled the function of the button nothing 
>> happened
>>
>> On Sunday, May 17, 2020 at 9:30:38 PM UTC-4, Motaz Hejaze wrote:
>>>
>>> In your like button form in your templates , 
>>> try this :
>>>
>>> 
>>>
>>> i don't think you need ajax for this , but if you still need it let us know
>>>
>>>
>>> On Mon, 18 May 2020, 2:26 am Gabriel Araya Garcia, <
>>> gabriela...@gmail.com> wrote:
>>>
 Hi Ahmed, I was looking for that during several months and I have found 
 examples than not run, and therefore I`ve get one conclution: "It`s not 
 posible to get that functionality in Django". No one could demostrate with 
 example code.
 If you find something, please send me the code.

 Thanks

   
 Gabriel Araya Garcia
 GMI - Desarrollo de Sistemas Informáticos




 El dom., 17 may. 2020 a las 20:15, Ahmed Khairy () 
 escribió:

> Hi all,
>
> I need some help writing the ajax for a like button instead of 
> refreshing every time a like is posted 
>
> here is the template: 
>
> 
> {% csrf_token %}
> {% if user.is_authenticated %}
> {% if liked %}
>  class= "btn btn-danger btn-sm" value="{{post.id}}"> Unlike  >
> {% else %}
>  class= "btn btn-primary btn-sm" value="{{post.id}}"> Like  >
> {% endif  %}
> {% else %}
>  Login > to Like 
> {{total_likes}} Likes 
> {% endif %}
>  
>
> Here is the urls:
> path('like/', LikeView, name='like_post'),
>
> here is the views:
> def LikeView(request, pk):
> post = get_object_or_404(Post, id=request.POST.get('post_id'))
> like = False
> if post.likes.filter(id=request.user.id).exists():
> post.likes.remove(request.user)
> like = False
>
> else:
> post.likes.add(request.user)
> like = True
> return redirect('score:post-detail', pk=pk)
>
> class PostDetailView(DetailView):
> model = Post
> template_name = "post_detail.html"
>
> def get_context_data(self, *args, **kwargs):
> context = super(PostDetailView, self).get_context_data()
>
> stuff = get_object_or_404(Post, id=self.kwargs['pk'])
> total_likes = stuff.total_likes()
>
> liked = False
> if stuff.likes.filter(id=self.request.user.id).exists():
> liked = True
>
> context["total_likes"] = total_likes
> context["liked"] = liked
> return context
>
>
>
> -- 
> 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...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/00707977-9b68-4329-a13d-adb9ab7b8813%40googlegroups.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...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/CAKVvSDCuegzvsZQ_Rfms3yMA_EO914T0yJ_n929mnx7bNDodUA%40mail.gmail.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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/76f6356b-17bc-4697-b6cf-966f01e9217f%40googlegroups.com
>>  
>> 

Re: HOW TO PROTECT SOURCE CODE DEPLOYED TO A REMOTE SERVER

2020-05-18 Thread Jim Armstrong
When I work on client projects, I deploy to a test server that is under my 
control. Once the project is complete and they have paid the invoice, I 
deploy to the production server under their control. At that point, I don't 
care if they have access to the code - my contracts give the clients all 
rights to the project code upon completion of the project.


On Friday, May 15, 2020 at 9:22:33 AM UTC-4, Sunday Iyanu Ajayi wrote:
>
> I am working for a client that wants to deploy a project I am working on 
> in a remote server and I will like to project my source code when deployed 
> so that they will not be able to mess with it. 
>
> How can  I  go about it please? 
>
> *AJAYI Sunday *
> (+234) 806 771 5394
> *sunne...@gmail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/636f0636-30df-4ce2-8629-2be8b208ec37%40googlegroups.com.


dealing with spam coming from scanning, script kiddies

2020-05-18 Thread f.holop
hi,

i am fishing for some ideas how to prevent django from doing a "lot of
drama" when some script kiddy is hitting it with a scan or other types
of invalid requests like this:


Subject: ERROR (EXTERNAL IP): Internal Server Error: /

Internal Server Error: /

ValueError at /
A string literal cannot contain NUL (0x00) characters.

Request Method: GET
Request URL: 
https://somehost/?action=48=../../../../../../../../../../etc/passwd%00.jpg=1
...


even with the admin emails turned off this logs a lot and that is not
cheap on a server that is already under a higher load from all this
nonsense.

obviously at some point some kind of rate limiting must be applied at a
lower layer, but even then these requests will keep coming spamming logs
and mails.

-f
-- 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20200518155657.GF12803%40obiit.org.


Re: Marketing django project

2020-05-18 Thread Fred XU
Hi,

Do you need Chinese guys for this project?

Fred

发自我的iPhone

> 在 2020年5月18日,21:44,maninder singh Kumar  写道:
> 
> 
> Dear all,
> 
> Require sales and marketing interns for django, javascript based artificial 
> intelligence project.
> 
> regards
> willy
> +91 9910669700
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CABOHK3TYdfAAeY%3DE5sdQsBpzwNSNKXtR%2BZGVd7u7txSqHszw7Q%40mail.gmail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/F321446E-B7F1-44BD-9DBC-836BC68C4AAF%40163.com.


Re: PROBLEM WITH Multiple SETTINGS.PY FILE

2020-05-18 Thread chaitanya orakala
Hi Jorge,
I tried placing a dot in front of settings_dev_sai, it didn't work. by the
way, I am using Python 2.7 and Django 1.10 versions.
[image: image.png]
this is my project structure.  I am using a virtual environment.
Please let me know what you think sir

On Sat, May 16, 2020 at 7:54 PM Jorge Gimeno  wrote:

> It's coming from your settings file.  I would try this:
>
> In this line here:
> elif HOST == "Sai" :
> from settings_dev_sai import *
>
> I would try to make the second line:
> from .settings_dev_sai import *
>
> See if Python can find the module that way.  If Python does, then all of
> the imports in that file need to be changed.
>
> If that's not the case, then we need to see what the directory structure
> looks like to figure this out.
>
> -Jorge
>
> On Sat, May 16, 2020 at 4:04 PM chaitanya orakala <
> chaitu.orak...@gmail.com> wrote:
>
>> Do you have any idea why i am getting this error?
>>
>> On Sat, May 16, 2020 at 6:40 PM chaitanya orakala <
>> chaitu.orak...@gmail.com> wrote:
>>
>>> Yes Jorge, all the settings file are in the same folder
>>>
>>>
>>> On Sat, May 16, 2020 at 5:20 PM Jorge Gimeno 
>>> wrote:
>>>


 On Sat, May 16, 2020 at 1:52 PM chaitan 
 wrote:

> Hi, I am facing ModuleNotFoundError in my Django application. It got
> configured with multiple settings files for production, Development &
> Testing.
> When I Try to run Python manage.py runserver --settings=
> settings_dev_sai.
>
> This is My *Settings* File:
>
> import socket
>
> #import settings depending on the box we are on
> HOST = socket.gethostname()
> TPA_CODE = "Bridge"
> TPA_NAME = "Bridge Benefits System"
>
> #development
> if HOST == "BITS-DP-LAPTOP":
> from settings_dev import *
> TPA_NAME = "ICBA Benefit Services Ltd."
> TPA_CODE = 'ICBA'
> #DFG bridge
> elif HOST == "dfginternal":
> from settings_dfg_ees import *
> TPA_NAME = "Dehoney Financial Group"
> TPA_CODE = 'DFG'
> #test
> elif HOST == "DFGTEST02":
> from settings_staging import *
> elif HOST == "icbaweb":
> from settings_production_icba import *
> TPA_NAME = "ICBA Benefit Services Ltd."
> TPA_CODE = 'ICBA'
> elif HOST == "meritweb":
> from settings_production_merit import *
> TPA_NAME = "Ontario Construction Industry Benefit Plan"
> TPA_CODE = 'MERIT'
> elif HOST == "dfgweb" :
> from settings_production_dfg import *
> TPA_NAME = "Dehoney Financial Group"
> TPA_CODE = 'DFG'
> elif HOST == "dev" or HOST == "j-ubu" :
> from settings_dev_baikal import *
> elif HOST == "jdev" :
> from settings_dev_juliab import *
> elif HOST == "Sai" :
> from settings_dev_sai import *
> elif HOST == "johnstonesweb" :
> from settings_production_johnstones import *
> TPA_NAME = "Johnstone's Benefits"
> TPA_CODE = 'JOHNSTONES'
> elif HOST == "bridgedemo" :
> from settings_demo import *
> TPA_CODE = "Bridge"
> TPA_NAME = "Bridge Benefits System"
> else:
> raise ImportError("This server's hostname [" + HOST + "] does not
> have a proper expanded settings file. Please configure one.")
> *
>
> This is my *settings_dev_sai*
>
> from settings_common import *
>
> DEBUG = True
> RUN_TYPE = RUN_DEV
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.postgresql_psycopg2',
> #'NAME': 'bridge_icba',
> 'NAME': 'bridge_js',
> #'NAME': 'bridge_dfg_internal',
> #'NAME': 'bridge_dfg',
> 'HOST': 'localhost',
> 'USER': 'django',
> 'PASSWORD': 'bridge_user',
> 'PORT': '',
> },
> }
>
> MEDIA_ROOT = 'C:/Users/DavidPiccione/Dropbox/Work -
> Bridge/Projects/bridge/MEDIA/'
> MEDIA_URL = '/media/'
>
> EMAIL_HOST = 'smtp.gmail.com'
> EMAIL_PORT = 587
> EMAIL_HOST_USER = 'bridgeautomaticmessen...@gmail.com'
> EMAIL_HOST_PASSWORD = 'bridgeautomaticmessenger123'
> EMAIL_USE_TLS = True
> DEFAULT_FROM_EMAIL = 'bridgeautomaticmessen...@gmail.com'
>
>
> STATIC_ROOT = ''
> STATIC_URL = '/static/'
> STATICFILES_DIRS = ("C:/Users/DavidPiccione/Dropbox/Work -
> Bridge/Projects/bridge/static",)
> STATIC_PATH = 'C:/Users/DavidPiccione/Dropbox/Work -
> Bridge/Projects/bridge/static'
>
> TEMPLATES = [
> {
> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
> 'DIRS': ["C:/Users/DavidPiccione/Dropbox/Work -
> Bridge/Projects/bridge/TEMPLATES",],
> 'APP_DIRS': False,
> 'OPTIONS': {
> 'context_processors': [
> 'django.contrib.auth.context_processors.auth',
> 

Re: I am facing issues in sharing module.

2020-05-18 Thread Akshat Zala
I am facing issue in quering the database.

I cannot write join query in django orm.

On Sunday, 17 May 2020 18:04:47 UTC+5:30, Akshat Zala wrote:
>
> I wish to share the post with friends in django application.
>
> My project flow chart is as follows:
>
>
> 1. User registers for an account.
> 2. User will recieve the email confirmation
> 3. By clicking on the link in email , he gets redirected to login page, 
> where he can login and he will see account successfully activated.
>
> 4. He/She can create /update/delete  the post.
> 5. He can view his profile,and update the profile.
>
> 6. He can search for friends through search bar by either of their first 
> name, last name, username and email address.
> 7. Results will be seen in tabular format.
> 8. By clicking on the hyperlink in add friend column a mail will be sent 
> to the friend_request with a hyperlink containing a template with 
> accept/reject buttons.
> 9. By clicking on either of the buttons, status of friend_request will be 
> updated accordingly  in the database as well as in the friend list template.
>
> Pending job is to Share the post with friend.
>
> 10. Now it is showing all the post to every registered user.
>
>
> Regards,
>
> Akshat Zala
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bf437ec1-3110-4b49-8dd2-51026a52eabf%40googlegroups.com.


Marketing django project

2020-05-18 Thread maninder singh Kumar
Dear all,

Require sales and marketing interns for django, javascript based artificial
intelligence project.

regards
willy
+91 9910669700

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABOHK3TYdfAAeY%3DE5sdQsBpzwNSNKXtR%2BZGVd7u7txSqHszw7Q%40mail.gmail.com.


RE: Re: How to resize image from Django ckeditor_uploader in the HTML template while rendering?

2020-05-18 Thread Vishesh Mangla
Sorry, I’ m just a beginner in Django but I think what you need to look at is the “Fetch API”. https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API.  https://www.youtube.com/watch?v=c3qWHnJJbSYYou can send an image through your view as HttpResponse(image_object in bytes/base64 format) object if request==”your desired one”. Then instead of your page reloading the fetch API will receivethe response and then you can use insertAdjacentHtml. For more details you can check the Django IRC channel   #django->https://webchat.freenode.net/ and ask there.  Sent from Mail for Windows 10 From: Ali AhammadSent: 18 May 2020 18:02To: Django usersSubject: Re: How to resize image from Django ckeditor_uploader in the HTML template while rendering? thanx for your reply. i am using pillow in my profile app. but the main issue is with ckeditor_uploader as you know i have to use RichTextUploadingField(). besides it i have to mention in urls.py and i have to render it corresponding variable name in the template. my main goal was if i upload any picture in body=RichTextUploadingField() in localhost/admin, i want to render the image and the text contents separately. in this case i couldn't find any document where i can learn about it. i tried to use ckeditor widgets but it just customizing the ckeditor toolbar. i dun want this and i am happy with what i have for now. so is there any way to render the uploading pic and resize and positioning in html template according to my own design? text can be separated and truncatchar:400 or 500 which i kew already. but i would like to separate the image from the text of the body. i hope you understand my problemOn Monday, May 18, 2020 at 12:49:53 PM UTC+1, Vishesh Mangla wrote:You can resize an image using the Pillow library or open-cv. Sent from Mail for Windows 10 From: Ali AhammadSent: 17 May 2020 22:45To: Django usersSubject: How to resize image from Django ckeditor_uploader in the HTML template while rendering? I am using Django ckeditor_uploader to make a post view for a blog. But while rendering in the template I wanted to render image separately from the post content texts. My main goal is to set the image separately on the template on top and resizing it. And I can set more pictures inside the post  but the top one will be highlighted and rendered in different HTML page. Is there any way? I tried to use ckeditor widget but it is just customizing the toolbar of ckeditor Please let me know if you have any idea  -- 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...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4b148528-7b15-4d39-8763-5f3a0f1931b6%40googlegroups.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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/44ef45ba-68ce-4e08-a516-c7ff1a827ff5%40googlegroups.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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5ec28c14.1c69fb81.ee3cc.aa1a%40mx.google.com.


Re: Incorrect query generated from ~Q/exclude

2020-05-18 Thread kirk
I struggled to find this in the Django ticketing system when I posted it, 
but I searched again this morning and found a few bugs that seem to be 
related.  They were closed with comments indicating that 
https://code.djangoproject.com/ticket/10060 seems to be the root cause.  
Looks like this is a known, longstanding issue.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b2d470bf-d2d7-45be-8874-0d448cbf660f%40googlegroups.com.


Re: How to resize image from Django ckeditor_uploader in the HTML template while rendering?

2020-05-18 Thread Ali Ahammad
thanx for your reply. i am using pillow in my profile app. but the main 
issue is with ckeditor_uploader as you know i have to use 
RichTextUploadingField(). besides it i have to mention in urls.py and i 
have to render it corresponding variable name in the template. my main goal 
was if i upload any picture in body=RichTextUploadingField() in 
localhost/admin, i want to render the image and the text contents 
separately. in this case i couldn't find any document where i can learn 
about it. i tried to use ckeditor widgets but it just customizing the 
ckeditor toolbar. i dun want this and i am happy with what i have for now.

so is there any way to render the uploading pic and resize and positioning 
in html template according to my own design? text can be separated and 
truncatchar:400 or 500 which i kew already. but i would like to separate 
the image from the text of the body. i hope you understand my problem

On Monday, May 18, 2020 at 12:49:53 PM UTC+1, Vishesh Mangla wrote:
>
> You can resize an image using the Pillow library or open-cv.
>
>  
>
> Sent from Mail  for 
> Windows 10
>
>  
>
> *From: *Ali Ahammad 
> *Sent: *17 May 2020 22:45
> *To: *Django users 
> *Subject: *How to resize image from Django ckeditor_uploader in the HTML 
> template while rendering?
>
>  
>
> I am using Django ckeditor_uploader to make a post view for a blog. But 
> while rendering in the template I wanted to render image separately from 
> the post content texts.
>
>  
>
> My main goal is to set the image separately on the template on top and 
> resizing it. And I can set more pictures inside the post  but the top one 
> will be highlighted and rendered in different HTML page.
>
>  
>
> Is there any way?
>
>  
>
> I tried to use ckeditor widget but it is just customizing the toolbar of 
> ckeditor
>
>  
>
> Please let me know if you have any idea 
>
>  
>
> -- 
>
> 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...@googlegroups.com .
>
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/4b148528-7b15-4d39-8763-5f3a0f1931b6%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/44ef45ba-68ce-4e08-a516-c7ff1a827ff5%40googlegroups.com.


RE: Re: how to write Ajax for a Like button in Django

2020-05-18 Thread Vishesh Mangla
Why don’t you use fetch api? Its simple. Once you get the response from the server, you can use InsertAdjacentHtml.  Sent from Mail for Windows 10 From: Motaz HejazeSent: 18 May 2020 07:34To: Django usersSubject: Re: how to write Ajax for a Like button in Django The button is submitted but without page refresh On Mon, 18 May 2020, 3:53 am Ahmed Khairy,  wrote:Hi Motaz, When I added your code it disabled the function of the button nothing happenedOn Sunday, May 17, 2020 at 9:30:38 PM UTC-4, Motaz Hejaze wrote:In your like button form in your templates , try this : i don't think you need ajax for this , but if you still need it let us know On Mon, 18 May 2020, 2:26 am Gabriel Araya Garcia,  wrote:Hi Ahmed, I was looking for that during several months and I have found examples than not run, and therefore I`ve get one conclution: "It`s not posible to get that functionality in Django". No one could demostrate with example code.If you find something, please send me the code. Thanks   Gabriel Araya GarciaGMI - Desarrollo de Sistemas Informáticos  El dom., 17 may. 2020 a las 20:15, Ahmed Khairy () escribió:Hi all, I need some help writing the ajax for a like button instead of refreshing every time a like is posted  here is the template:  {% csrf_token %}{% if user.is_authenticated %}{% if liked %} Unlike button>{% else %} Like button>{% endif  %}{% else %} Logina> to Like small>{{total_likes}} Likes strong>{% endif %}form>  Here is the urls:path('like/', LikeView, name='like_post'), here is the views:def LikeView(request, pk):post = get_object_or_404(Post, id=request.POST.get('post_id'))like = Falseif post.likes.filter(id=request.user.id).exists():post.likes.remove(request.user)like = False else:post.likes.add(request.user)like = Truereturn redirect('score:post-detail', pk=pk) class PostDetailView(DetailView):model = Posttemplate_name = "post_detail.html" def get_context_data(self, *args, **kwargs):context = super(PostDetailView, self).get_context_data() stuff = get_object_or_404(Post, id=self.kwargs['pk'])total_likes = stuff.total_likes() liked = Falseif stuff.likes.filter(id=self.request.user.id).exists():liked = True context["total_likes"] = total_likescontext["liked"] = likedreturn context   -- 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...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/00707977-9b68-4329-a13d-adb9ab7b8813%40googlegroups.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...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAKVvSDCuegzvsZQ_Rfms3yMA_EO914T0yJ_n929mnx7bNDodUA%40mail.gmail.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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/76f6356b-17bc-4697-b6cf-966f01e9217f%40googlegroups.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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHV4E-fDsKvr77YCUwjttDQJ7nx6f9%2Bj0ZZCByUa1Ygr%3DOoY1Q%40mail.gmail.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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5ec22272.1c69fb81.dac63.72cc%40mx.google.com.


Postgresql and mysql

Hi ,
Mysql query which we used previously now we moved to postgresql,
Here is the below query in mysql , Can anyone help me to write
similar query in postgresql.

query = "LOAD DATA LOCAL INFILE '41098_category_list.txt' INTO TABLE
pages_rim_ls_categories FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n' "

Thanks
~salima

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6bnNUZ0XK%3DBbnwhNrEcVEe6Lpab0uazxvXtskZcR_MZ2uA%40mail.gmail.com.


Categories and shoe Subcategories according to the parent category.

Hi, if i add Categories , for example 
1)accessories
2)sports
3)books
Subcategories:
accessories is the parent category
child categories are 
watches
jewlry
caps 
how can i show if  user selects the parent category accessories then the 
subcategories show according to parent categories like subcategories are 
watches jewlry etc

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1530c511-072f-44ee-83fa-3555bd090a89%40googlegroups.com.


RE: How to resize image from Django ckeditor_uploader in the HTML template while rendering?

You can resize an image using the Pillow library or open-cv. Sent from Mail for Windows 10 From: Ali AhammadSent: 17 May 2020 22:45To: Django usersSubject: How to resize image from Django ckeditor_uploader in the HTML template while rendering? I am using Django ckeditor_uploader to make a post view for a blog. But while rendering in the template I wanted to render image separately from the post content texts. My main goal is to set the image separately on the template on top and resizing it. And I can set more pictures inside the post  but the top one will be highlighted and rendered in different HTML page. Is there any way? I tried to use ckeditor widget but it is just customizing the toolbar of ckeditor Please let me know if you have any idea  -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4b148528-7b15-4d39-8763-5f3a0f1931b6%40googlegroups.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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5ec172ad.1c69fb81.c11b1.48eb%40mx.google.com.