Q:

How to send image file without saving in database using django framework

I'm a novice in Django an am stuck in Django views.py am two field in forms.py 1st CharField 2nd ImageField my CharField is successfully rendered but ImageField does not render how solved this I want to send image file with tweet without saving in database please me to solved this problem thanks
my files are here- 
forms.py 
from django import forms

class HomeForm(forms.Form):
  tweet = forms.CharField()
  img = forms.ImageField(label='Select a Image file',)

Views.py
from django.http import HttpResponseRedirect
from django.shortcuts import render
from .forms import *
from django.views.generic import TemplateView

class Texting(TemplateView):        
  Template_name =  'app_temp/xyz.html'

  def get(self, request):
    form = HomeForm()
    return render(request, self.Template_name, {'form': form})

  def post(self, request):
    access_token = 'XYZ'
    access_token_secret = 'PQR'
    consumer_key = 'LMN'
    consumer_secret = 'ABC'
    api = TwitterAPI(consumer_key, consumer_secret , access_token , access_token_secret )
    form = HomeForm(request.POST , request.FILES)
    if form.is_valid():
        text = form.cleaned_data['tweet']
        img = form.request.FILES['img'] 

        r = api.request('statuses/update_with_media', {'status':text}, {'media[]':img})
    return render(request,'app_temp/new_page.html')

html
{% extends 'login_base.html'%}

{% block content %}

<div class="container">
   <form method="POST">
         {% csrf_token %}
         {{ form.as_p }}
         <button type="submit" class="btn btn-primary">Tweet</button>
   </form>
   <h1>{{img}}</h1>
    <h1>{{text}}</h1>
 </div>
{% endblock  %}

A:

statuses/update_with_media is deprecated. This API call has been replaced by a two step process. First, upload the image using media/upload. Second, post your tweet with a media ID using statuses/update. You will find a complete example at https://github.com/geduldig/TwitterAPI/blob/master/examples/update_media.py.
# STEP 1 - upload image
file = open(IMAGE_PATH, 'rb')
data = file.read()
r = api.request('media/upload', None, {'media': data})
print('UPLOAD MEDIA SUCCESS' if r.status_code == 200 else 'UPLOAD MEDIA FAILURE')

# STEP 2 - post tweet with a reference to uploaded image
if r.status_code == 200:
    media_id = r.json()['media_id']
    r = api.request(
        'statuses/update', {'status': TWEET_TEXT, 'media_ids': media_id})
    print('UPDATE STATUS SUCCESS' if r.status_code == 200 else 'UPDATE STATUS FAILURE')

