-1

I'm currently trying to add push notifications to my iOS app. My backend server is a Django server deployed on Google Cloud Platform.

I've been using django-push-notifications on my backend and I was having trouble actually sending messages. When I try to send a message to a device, I get this error:

FileNotFoundError: [Errno 2] No such file or directory: '/AuthKey_0123456789.p8'

(Note I replaced the name of the file with dummy data).

I placed my .p8 file in the root of my directory and then ran google app deploy. Does anyone know where I should actually be storing the file and also what the path for the APNS_AUTH_KEY_PATH settings key should be?

kbunarjo
  • 1,277
  • 2
  • 11
  • 27

1 Answers1

0

Found the answer here.

Basically, you can keep the .p8 file in the root of your app's directory, and then have your push notifications settings look like this:

PUSH_NOTIFICATIONS_SETTINGS = {
        "APNS_AUTH_KEY_PATH": os.path.join(BASE_DIR, "your_cert.p8"),
        "APNS_AUTH_KEY_ID": "YOUR_AUTH_KEY",
        "APNS_TEAM_ID": "YOUR_TEAM_ID",
        "APNS_TOPIC": "YOUR_TOPIC", # usually same as device bundle name
        "APNS_USE_SANDBOX": True, #or false
}
kbunarjo
  • 1,277
  • 2
  • 11
  • 27