Browser keeps spinning. apache2 complains it cannot read home directory. Proper config for plotly plots and apache web app in offline mode?

Hi , I have a django python app that accepts csv raw output from a DNA analysis machine and processes it in pandas and plots it using plotly.
The calls in plotly are

figure = go.Figure(data=data, layout=layout)
div = plotly.offline.plot(figure,auto_open=False,output_type=“div”)

These graph html are then rendered in the django template:

{% for graph in graphs %}

{{ graph|safe }}

{% endfor %}

When I go to host this app using the apache2 on my Linux box or on amazon elasticbeanstalk , I see the message in my apache2 error_log saying what it says below. The webserver then just keeps spinning and never responds.

[Mon May 15 22:13:20.813775 2017] [wsgi:error] [pid 16943:tid 140167217755904] Looks like you don’t have ‘read-write’ permission to your ‘home’ (’~’) directory or to our ‘~/.plotly’ directory. That means plotly’s python api can’t setup local configuration files. No problem though! You’ll just have to sign-in using ‘plotly.plotly.sign_in()’. For help with that: ‘help(plotly.plotly.sign_in)’.
[Mon May 15 22:13:20.813780 2017] [wsgi:error] [pid 16943:tid 140167217755904] Questions? Visit

To get around this possible permission error I created a .plotly directory with valid credentials in my home directory and even set the directory read/write status to 777. I also tried signin in as recommended in my code

plotly.plotly.sign_in(username=‘myname’, api_key=‘mykey’)

Under all these setups the web browser just waits and does not log any error or even go on to the next step. It just seems stuck.

If I uncomment the line to call the plotting function everything proceeds as normal.

Something about calling plotly with mod_wsgi and apache blocks and does not proceed properly.

Can someone help me get my apache config right. What user does plotly run as and how do I get it to give the plot divs in an apache setup.