I am newbie to djnago and python, I want to generate the report of testcases run by djnago and send in mail to team.
Please help me
Django coverage package make a html file.
If you have multiple settings for your project you should run tests for each setting then combine result with (coverage combine) command then you can get a html file and attach the file in email even you can render result like django html templates.
With python subproccess you can run shell command in django.
Related
I have built a platform on django for running python scripts. The user is able to write their Python script in a text-area and when a button is clicked, the script should run on the back-end. It should also check for test cases from a database (like Hackerrank).
I have tried using the eval() function but the problem is that when the user writes input() in their code it should take the values from database for input.
Please help me figure this out.
I am working on a project which periodically downloads stock details as a json file from a web server and save locally for user requestes .Since it is not appropriate to download the same for each user request i need help in doing that
I know how to do it using cron but i prefer it in django itself ..
Write a django command using while True loop and thread.sleep(intervaltime) function.
And after starting django server, run this python manage.py commandname
I'm not sure where to begin, as in do I start working towards PHP, Ruby or what, but here is what I'd like to do:
I have a Python script that takes a pre-formatted Excel document and using xlrd and Django, I output a nicely formatted HTML page, based on a template HTML page.
But currently on my team, I'm the only one that can use this Python script because our setups, and I'd like to simplify the process by creating a web app that has a couple drop down menus to specify which script to run, then let me upload the .xls file, at which point the HTML file is automatically generated and a download link is created or the HTML file is spit out somehow.
Does anyone have any guidance as to how I should even begin this project?
I would suggest having a good read of the django docs, and probably working through the tutorials.
Django's documentation is very good.
If you just want to hack at the code you've got then probably read the following to get a very basic overview of some core django functionality -
url dispatcher
views
models
forms
templating
With your app, the url dispatcher will pass the request to a view which will use a template to render your excel document.
You want a form to handle your user parameters and a single view to render and process the form and also render the excel template.
I am trying to use HTSQL for one of my Django projects. For that I followed the procedure given HERE for furnishing HTSQL/Django requirements. Then I cloned the HTSQL repository for trying the example/demo in it from HERE. I am testing this on Django v1.4. The default db used in the demo example is sqlite3. In Django python shell, the queries are working fine now as per THIS question. But as demonstrated on HTSQL Website, it has a very powerful frontend to communicate with the database and also generates efficient queries (reference). I am trying to use this particular feature for my Django application which is also demonstrated in the demo/example django app from HTSQL. In the demo app, when I started my local django server and tried to access the following url:
localhost:8000/htsql/
The page loads and when I write the following lines:
/polls_poll
to see the data from the polls_poll table, the RUN button does nothing and so does the more drop down menu. No error, no response, no data fetched from the polls_poll table. Then I noticed that the page wasn't loading properly i.e this trace was generated on the Django server terminal. So basically,
codemirror .js and .css files were throwing HTTP 500 error. For that I searched for the links of the codemirror .css and .js files and provided those links in the index.html of the HTSQL resided in the static folder. Following is its path:
>>> /usr/local/lib/python2.7/dist-packages/htsql/tweak/shell/static
Now the terminal trace has changed to THIS
But still the RUN button does nothing and no data is fetched from the table polls_poll
Am I doing something wrong or missing something??
CodeMirror just changed the download URL for their packages, which broke HTSQL shell. You either need to apply the following patch manually:
https://bitbucket.org/prometheus/htsql/changeset/f551f8996610bb68f2f8530fc6c0dbf6b5c34d90
or you can wait for the next bugfix release of HTSQL, which will be out in a day or two.
I need to populate sample data for Django Image/File fields in automated python code.
I want to initialize Django ImageFields and FileFields with some sample images and data files that are stored in my "site_media" directory of my Django project.
What would the code look like? This is not for testing, I want to autopopulate sample data into my Django website user's accounts (including this sample Imgae/File media.)
This should be done in python code without using fixtures.
If I understand you correctly you want to use fixtures, basically a JSON formatted file that holds data that will be put into the project database. They can be executed through the django-admin command like :
django-admin.py loaddata mydata.json
see http://docs.djangoproject.com/en/1.2/ref/django-admin/#loaddata-fixture-fixture