Re: The SECRET_KEY setting must not be empty - os.environ.get('SECRET_KEY')

2022-03-02 Thread Carsten Fuchs
Am 03.03.22 um 04:43 schrieb Adeyemi Deji:
> What do u mean by on installation @On installation, the file is then copied 
> to localconfig.py, where it is *ignored* by svn, git, etc. The file is then 
> customized for production, development, …
> 
> Do u mean during deployment?

During development, you create two files:

localconfig.example
This file contains only example data, comments/instructions and *irrelevant* 
data, such as *fake* secret keys, fake database passwords, etc. This file is 
committed to the repository. Its *only* purpose is to serve as an example and 
be copied to filename localconfig.py later.

localconfig.py
Created from a copy of localconfig.example, during development you must make 
sure that this file is never committed to your repository. This is achieved by 
telling the repository to ignore it, e.g. Git by editing the .gitignore file 
appropriately, Subversion with the svn:ignore property. Still during 
development, you customize the file as needed for development, i.e. insert the 
required database details, DEBUG = True, etc.

For deployment, when you first clone the repository on the production server, 
it will come with the localconfig.example file, but not with the localconfig.py 
file, as intended. As part of the installation, you copy localconfig.example to 
localconfig.py and customize it for production (production database, etc.). 
Done.

Variants of this approach are possible, e.g. keeping the localconfig.py file 
entirely outside of the project directory, where it is in even less danger to 
be accidentally committed. Or to store the values not in a py, but in a json, 
ini, txt, ... file that is loaded and parsed in settings.py.

Best regards,
Carsten


> On Wed, Mar 2, 2022 at 7:49 AM Carsten Fuchs  > wrote:
> 
> Am 02.03.22 um 04:23 schrieb Mike Dewhirst:
> > ... where you write get_secret_key() to pull it from the environment or 
> a file somewhere which is not in your repository.
> 
> A variant of this that I like is to have a file like localconfig.example 
> in the repository next to settings.py that contains e.g.
> DATABASES = ...  # dummy or default config
> SECRET_KEY = 'example'
> 
> On installation, the file is then copied to localconfig.py, where it is 
> *ignored* by svn, git, etc. The file is then customized for production, 
> development, …
> 
> In settings.py, there is
> 
> from project_dir import localconfig
> # ...
> DEBUG = localconfig.DEBUG
> SECRET_KEY = localconfig.SECRET_KEY
> DATABASES = localconfig.DATABASES
> # ...
> 
> This works very well and is simple, safe and convenient.
> 
> Best regards,
> Carsten
> 

-- 
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/08a9d115-235f-3538-70fa-e6e9ecdb404f%40cafu.de.


Re: The SECRET_KEY setting must not be empty - os.environ.get('SECRET_KEY')

2022-03-02 Thread Adeyemi Deji
Thanks Carsten, It's also a great method.
What do u mean by on installation @On installation, the file is then copied
to localconfig.py, where it is *ignored* by svn, git, etc. The file is then
customized for production, development, …

Do u mean during deployment?

On Wed, Mar 2, 2022 at 7:49 AM Carsten Fuchs  wrote:

> Am 02.03.22 um 04:23 schrieb Mike Dewhirst:
> > ... where you write get_secret_key() to pull it from the environment or
> a file somewhere which is not in your repository.
>
> A variant of this that I like is to have a file like localconfig.example
> in the repository next to settings.py that contains e.g.
> DATABASES = ...  # dummy or default config
> SECRET_KEY = 'example'
>
> On installation, the file is then copied to localconfig.py, where it is
> *ignored* by svn, git, etc. The file is then customized for production,
> development, …
>
> In settings.py, there is
>
> from project_dir import localconfig
> # ...
> DEBUG = localconfig.DEBUG
> SECRET_KEY = localconfig.SECRET_KEY
> DATABASES = localconfig.DATABASES
> # ...
>
> This works very well and is simple, safe and convenient.
>
> Best regards,
> Carsten
>
> --
> 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/27159e6a-0472-97c5-8816-7c5a46a3eb89%40cafu.de
> .
>

-- 
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/CAEO1GrqUrHfxBL_J1cGHDjjVdbbfciBTpc322%3DZZFOMckcx-qw%40mail.gmail.com.


Re: need help

2022-03-02 Thread shubham goyal

Can help you make one. 
On Tuesday, 1 March 2022 at 22:13:06 UTC+5:30 ngounou...@gmail.com wrote:

> Please i need a management medical record app of patients built in django 
> using REST API

-- 
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/04cf4aa5-94d5-4c6f-9bda-896f2d140128n%40googlegroups.com.


Re: Freepik like website development

2022-03-02 Thread shubham goyal
First of all thankyou for choosing django.
Django is awesome to help you manage the all you mentioned above (images, 
authentication, feature).

Apart from django (which is mostly backend), you may need frontend 
developers who are good with (js, css, html).
Other than that you need cloud instance to host your project.

In my opinion,
There are no free efficient hosting platform and you will be charged 
monthly for it.

Once your project is hosted and devlopment is done.
Your need to maintain + market it.
On Monday, 28 February 2022 at 23:11:54 UTC+5:30 Aladdin wrote:

> Hello there,
> I am Abdus Salam and I want to develop a website like Freepik 
> . It will consist of a database to store the images, 
> authentication, and a feature for people to share their work from all over 
> the world. I am not sure if I should use Django or some other frameworks 
> and If am using Django then what should I know to finish this project. 
> Feel free to reply it will be great to have you contribute to this 
> project...
> ThankYou!!
>
> Regards,
> Abdus Salam
>

-- 
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/5963da65-22e0-4bc9-8f9d-0ea07655c20fn%40googlegroups.com.


trying to getJSON data from database, but there is a problem with rendering

2022-03-02 Thread UGC
Hey all,

I have the models .py with employee and all the info.
With one click i want to render all the info of my employee.

When i click on the button i see the data on my js console , but i dont see 
it come on the page frontend. i think i have problems with the key but i 
dont know. here is the code..

views.py
in this function i want to get the id of the name by jsonloads by clicking 
the name*(this works)*

def check(request):
if request:
if request.method == 'POST':
data = json.loads(request.body)
employeId = data['id_s']
empinfo = Employe.objects.filter(id=employeId)
print(empinfo)
print(data)
return JsonResponse({'data': list(empinfo.values())}, safe=False, 
status=200)
return HttpResponse()

js code is here.
in these code i want to get the data by fetch url. i can see on the console 
log that the data is recieved*(these function works good aswel)*
--
function checkEmp(id_s, action){

var url = '/checks/'

fetch(url, {

method: 'POST',
headers:{
'Content-Type':'application/json',
'X-CSRFToken': csrftoken,
},
body:JSON.stringify({'id_s': id_s, 'action': action})
})
.then((response)=>{
return response.json()

})
.then((data)=>{
console.log(data);

})


}
index.html
i think that the problem is here.  i want that these function would get the 
data of fetch and render it on the template*(dont work)*
--
$(document).ready(function() {
$(".info-employe").click(function(event){
$.getJSON('/checks/', function(response, data) {
for(var key in response.data )
$('#name').append(' Name: ' + response.data[key].name + '');
$('#surname').append('Surname : ' + response.data[key].surname + '');
$('#worknumber').append(' Work number: ' + 
response.data[key].work_number + '');
$('#workplace').append(' Rank: ' + response.data[key].rank + '');
$('#rank').append(' Workplace: ' + response.data[key].workplace + 
'');
$('#email').append(' Email: ' + response.info[key].email + '');
$('#phone').append(' Phone: ' + response.data[key].phone + '');
});
});
});

i am 4 monts in tho code and maybe i miss one thing that i need to learn in 
these task. can someone give me a tip what i miss here, or what i need to 
learn if i want use these sort functions. thanks alot and srry for my bad 
english :)))

-- 
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/ee7b4af0-4ff4-4a71-8e62-2b4fd783d05en%40googlegroups.com.