Integrate appliction into Django

24 views
Skip to first unread message

Alain Muls

unread,
Feb 28, 2016, 7:50:30 AM2/28/16
to Django users
Hi All,

I made a program that creates 4 plots and text files about the location of GNSS (Global Navigation Satellite Systems) based on TLEs downloaded from NORAD.

I would like  to use this program in django (I started with edge-django as my template). But I don't know how to start with it. How would I define a model/view for displaying the plots and text files and how can I allow users to download these results?

Thanks for your help
Alain

Bob Gailer

unread,
Feb 28, 2016, 8:31:12 AM2/28/16
to Django users

Start with the Django tutorial?

>
> Thanks for your help
> Alain
>

> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ed296d1a-1fcb-4d1f-9592-0e7bec2a4d3a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Rahul Gandhi

unread,
Feb 28, 2016, 12:54:30 PM2/28/16
to Django users
I haven't had a look at the github link, but if all you want to do is to display plots (I'm assuming these are images) and text files, then all you need to do is to serve these files from the views to the templates. 

You can store these plots/text files in a directory which is accessible to your views. A good place for this would be the static files. This way the users can download them to. 
Assuming that the plots and the text files are different for different users, you need to pass user specific parameters to your view, which in turn would use GNSSTracking and save the plots/text files in the static folder with some unique name. You can then pass these unique names to your template and then display them. If there is any user specific data you need to store, then you define models based on whatever data you need to save.

If none of this makes any sense, then I suggest you first understand the basics of Django.

Derek

unread,
Feb 29, 2016, 1:44:40 AM2/29/16
to Django users
In addition, I am not sure you have to use Django here; a simpler Python web-framework like Flask might be more suited (there you don't have to have models; just views). 

You could write a view that loads the text file and converts it (via a jinja template) into an HTML table, for example.  This page in turn could be linked to a view that loads the file, converts it to CSV (?) and then returns that to the browser - most modern browsers would either allow the user to download the file, or offer to open it in Excel/LibreOffice. 

I would assume the plots are in standard PNG or JPEG format and could be displayed directly via img tags. 

There are lots of code examples for Flask, so if you Google around, you are likely to find bits-and-pieces you can reuse.
Reply all
Reply to author
Forward
0 new messages