Skip to content

Category: Github

Git pull request

https://opensource.com/article/19/7/create-pull-request-github Account donaldtest fork the repos from spawnmarvel: https://github.com/donaldtest/powershellcode git clone https://github.com/request-user/demo cd foldergit checkout -b new_branch git remote add upstream https://github.com/fork-user/demo Now you can…

pywinservice, running a simple Python script as a windows service

pywinservice, running a simple Python script as a windows service
Code:
Make a virtualenv, store your code there.
Make a run.py file, in that file you can start / call a database, a webcrawler, http, mail or whatever code you want to execute.
When you are done with coding your scripts, test this:
Make a bat file, that will be started when the service starts (i.e 3 party libraries will start)
First:
  • Activate the env: ~\pywinservice\Scripts\activate.bat

Second:

  • Call the Python script file, ie run.py python app\run.py runserver

Make some log statments also, always good.

If the test is success:

Download NSSM – the Non-Sucking Service Manager.

https://nssm.cc/download

  • nssm install, navigate to your bat file, give the service a name

Start the service with the name you made

Django database API foreign key 102

https://docs.djangoproject.com/en/2.0/topics/db/queries/

 

Our models have now changed and a new model has been added to e-lo.

In RawText, we store the input, in BlobText we store the functions from TextBlob lib. If we remove the instance from the first table, we also need to remove it from the second. Ref on_delete = models.CASCADE

Lets add two instances and view them, then delete them.

 

Django database API migrations and models 101

Django API

Once you’ve created your data models, Django automatically gives you a database-abstraction API that lets you create, retrieve, update and delete objects. This document explains how to use this API. Refer to the data model reference for full details of all the various model lookup options.

https://docs.djangoproject.com/en/2.0/topics/db/queries/

So our testmodel is a simple Note where we store text from the user. This is our base for e-lo on web.

We feed e-lo some text and select a of several NLP functions that will be implemented later (Some of them are implemented, but must interfaced with Django, now they are interfaced with class cmd.Cmd([completekey[, stdin[, stdout]]]).