Skip to content

Instantly share code, notes, and snippets.

@Chukslord1
Created July 31, 2021 13:38
Show Gist options
  • Save Chukslord1/9b141115253ee4540166e2bcbf746641 to your computer and use it in GitHub Desktop.
Save Chukslord1/9b141115253ee4540166e2bcbf746641 to your computer and use it in GitHub Desktop.
Agora Video Application
def index(request):
app_id="replace_with_app_id"
if request.method=="POST":
channel=request.POST.get("channel")
new=request.POST.get("new")
if new:
dir(secrets)
channel=secrets.token_urlsafe()
url="agora/?channel="+channel
save_channel=Channel.objects.create(channel=channel,app_id=app_id)
save_channel.save()
meeting = Meeting.objects.create(channel=channel)
meeting.save()
return redirect(url)
if Meeting.objects.filter(channel=channel):
url="agora/?channel="+channel
if Channel.objects.filter(app_id=app_id,channel=channel):
channel_delete=Channel.objects.get(app_id=app_id,channel=channel)
channel_delete.delete()
save_channel=Channel.objects.create(channel=channel,app_id=app_id)
save_channel.save()
else:
save_channel=Channel.objects.create(channel=channel,app_id=app_id)
save_channel.save()
return redirect(url)
return render(request,"app1/index.html")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment