Jump to content

Django On Tommy


albertoc

Recommended Posts

Yeah, no problem. We all would appreciate it if you could create a wiki account at http://wiki.helionet.org/ and create a tutorial for people to do what you have just done. This would be especially useful for people if you use windows on your home pc since most people use that os. I find it makes more sense to people from the point of view of another user such as yourself. You could use http://wiki.helionet.org/Java_Servlet http://wiki.helionet.org/Installing_an_SSL_Certificate_on_Tommy_with_ZeroSSL or http://wiki.helionet.org/Running_Auto_Backups as templates.

Link to comment
Share on other sites

  • 2 weeks later...

Hi guys!
I'm still trying to fully setup the website on Tommy, but I'm facing some issues..

 

When I run the django server locally on my computer at home and I execute some operations (POST requests from IoT devices) they are satisfied and I can see the records being added to the server.

When I make the devices perform POST requests at my django app on heliohost, I cannot see any change.

 

This made me think that it could have been a permissions problem on the sqlite Database, since I can make django read some test data from it ( http://sest.gq/1/ ) but I cannot make it write to it, and the view showing the channel/feed stays empty ( http://sest.gq/2/ ). I changed the permissions on the db.sqlite3 file to 777, but nothing changed.

 

 

So I'm asking if there's any way to debug a django app on heliohost, which is not working only there, and without having access to the django logs (so I cannot insert print statements neither, while it's working on POST requests from my devices).

Any hint? An other attempt would be to setup a proper DB engine, like postgresql, to work with my app.

Link to comment
Share on other sites

I solved the problem relative to sqlite: by using curl and performing a request to the server, I saw the error: the solution is to set the permission to 770 (allowing writing to the users of my same group) to the parent folder containing the db.sqlite3 file (in my case is public_html/):

http://stackoverflow.com/questions/7670289/sqlite3-operationalerror-unable-to-open-database-file/7670618#7670618

 

 

Another problem I have now is that I'm using a small python package in my project: https://github.com/Stranger6667/postmarker

it's a python package that sends requests to Postmark that afterwards sends emails (according to some conditions inside my application).

This package doesn't spam, since it's just a wrapper that sends requests to a third-party service, so it doesn't use tommy's IP address to send email.

Could you be so kind to install it on tommy?

Link to comment
Share on other sites


# /usr/local/python3.6/bin/pip3.6 install postmarker
Collecting postmarker
Downloading postmarker-0.8.1-py2.py3-none-any.whl
Collecting requests (from postmarker)
Downloading requests-2.13.0-py2.py3-none-any.whl (584kB)
100% |████████████████████████████████| 593kB 1.5MB/s
Installing collected packages: requests, postmarker
Successfully installed postmarker-0.8.1 requests-2.13.0
Link to comment
Share on other sites

Yeah, no problem. We all would appreciate it if you could create a wiki account at http://wiki.helionet.org/ and create a tutorial for people to do what you have just done. This would be especially useful for people if you use windows on your home pc since most people use that os. I find it makes more sense to people from the point of view of another user such as yourself. You could use http://wiki.helionet.org/Java_Servlet http://wiki.helionet.org/Installing_an_SSL_Certificate_on_Tommy_with_ZeroSSL or http://wiki.helionet.org/Running_Auto_Backups as templates.

Done: http://wiki.helionet.org/Django#Getting_started_with_Django_1.10

 

check it out, any feedback is appreciated!

Link to comment
Share on other sites

Looks good. Does typing 0.0.0.0:8000 into a browser actually work though? Setting a server to listen on 0.0.0.0:8000 means to listen on all available IP addresses on port 8000, but 127.0.0.1:8000 or localhost:8000 is what I would think you would need to type into the browser for the loopback address. I've never tried 0.0.0.0:8000 though.

Link to comment
Share on other sites

0.0.0.0/32 is a reserved IPv4 address: it allows a server listening on it to listen to all the interfaces available on the local machine.

It's a little broader than 127.0.0.1

If you try to launch a "normal" python manage.py runserver, you can only browse the app on localhost or on 127.0.0.1, but you cannot visit it from any other address of the class 127.0.0.0/32.

And I think it's useful even if you want to make others (on your same network) to browse your app (obviously you need to open the port 8000 though). With localhost you can't.

 

You can change it if you prefer.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...