How to connect Salesforce database in Django? Perform API calls using Python?

227 views Asked by At

How to connect Salesforce database in django? Perform API calls using Python ?

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'salesforce_db',
    },
    'salesforce': {
        'ENGINE': 'salesforce.backend',
        "CONSUMER_KEY" : 'EDIT: your key you get.......................',
        "CONSUMER_SECRET" : 'EDIT secret you get',
        'USER': 'EDIT [email protected]',
        'PASSWORD': 'EDIT password + security_token',
        'HOST': 'https://login.salesforce.com',
    }
}

SALESFORCE_QUERY_TIMEOUT= (4, 15)
1

There are 1 answers

0
hynekcer On

The System Administrator user can configure permissions for an application to use Salesforce API. Open Salesforce Lightning in a web browser, click Setup > Apps > App Manager > New Connected App (a button on the upper right corner).

You make a name of your application (or a name of a group of your applications that could be trusted/disabled together), fill some related required fields and click "Enable OAuth Settings" to see related settings. Select then the scope "Manage user data via APIs (api)" in "Available OAuth Scopes" and click "Save". You will see a "Consumer Key" and "Consumer Secret" for your application or you can see it later if you click "View" in "App Manager" at the end of your line.

I think that other details are good described in the documentation of django-salesforce, but the upper right corner and Available OAuth Scopes are the most important details that will be added to this documentation so that the extensive documentation about Salesforce - OAuth 2 does not have to be read at all in the most simple case.