OneSignal - free multiplatform push notification service
Send 100% FREE push notifications to Android, iOS, Web by their completely free SDKs on
OneSignal
. #OneSignal is multiplatform push notification service that you just interact with it using API calls in JSON format. It has a thorough documentation for SDKs and Server API.* BE AWARE THAT use
OneSignal
in case your user's privacy does not matter to you! They have mentioned in their privacy policy that they sell this information!!! All device locations, user email addresses and all the other sensetive data will be collected by OneSignal
.#push_notification #push #ios #android #web #notification #one_signal
It is sometimes tempting to log less in order to let's say improve performance or save disk space, and blah blah blah!
Loggers in python are the last thing to think about when you think about performance. You can place log ratote to use less disk space. From my own experience log as much as you can. Log as every step necessary to make log level verbose. At last in case you think you application is very stable you change log level to info, and all debug logs are ignored.
It took sometimes hours to debug a few modules (in microservice structure) to find the culprit, something that could have been solved by putting more logs.
Log, log and log more...
#python #log #logger #performance
Loggers in python are the last thing to think about when you think about performance. You can place log ratote to use less disk space. From my own experience log as much as you can. Log as every step necessary to make log level verbose. At last in case you think you application is very stable you change log level to info, and all debug logs are ignored.
It took sometimes hours to debug a few modules (in microservice structure) to find the culprit, something that could have been solved by putting more logs.
Log, log and log more...
#python #log #logger #performance
UWSGI - Web server Gateway Interface
-----
uwsgi is a big C application which is used to deploy python applications on server. There is a full documentation of UWSGI in
Reference: http://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html
#python #uwsgi #reference #flask #readthedocs
-----
uwsgi is a big C application which is used to deploy python applications on server. There is a full documentation of UWSGI in
readthedocs
, follow it and master it to handle loads of requests concurrently and use graceful reloading of the app. It is usually put behind a full web server like nginX by proxying.Reference: http://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html
#python #uwsgi #reference #flask #readthedocs
Forwarded from Deleted Account
جلسه ۴۹ گروه کاربران پایتون تهران، پنجشنبه ۱۱ آبان ۱۳۹۶ از ساعت ۱۴:۳۰ تا ۱۶:۰۰ در «شتابدهندهٔ آواتک» به نشانی «تهران، خیابان کارگر شمالی، بالاتر از بزرگراه جلال آل احمد، پردیس دانشکدههای فنّی دانشگاه تهران، دانشکدهٔ مهندسی نفت، طبقهٔ پنجم» برگزار خواهد شد.
در صورتی که داوطلب ارائه فنی هستید موضوع ارائه خود را به میلینگ لیست گروه کاربران پایتون تهران ارسال کنید.
https://mail.python.org/mailman/listinfo/tehpug
یا به بنده پی ام دهید.
در صورتی که داوطلب ارائه فنی هستید موضوع ارائه خود را به میلینگ لیست گروه کاربران پایتون تهران ارسال کنید.
https://mail.python.org/mailman/listinfo/tehpug
یا به بنده پی ام دهید.
PART-1: Basic docker commands
* Let's suppose you have built an image.
Display list of your docker images:
Output:
As you can see image name is
To run the image:
The above command runs the docker image. The newly created processs by
host, and the second port
Now to see list of your containers use
From here you can see the ID of your container which is equal to
ontainer (login into container):
if you want to connect to the stdout of your container use
*** IF you are attached to a container and press ^c afterward, the container will be stopped.
If you want to stop a container:
It prints out container id
#docker #commands #docker_part1 #basic #container #devops
* Let's suppose you have built an image.
Display list of your docker images:
docker images
Output:
REPOSITORY TAG IMAGE ID CREATED SIZE
py_app latest baa470dc5609 3 weeks ago 591MB
As you can see image name is
py_app
.To run the image:
docker run -it -d -p 8085:8084 py_app
The above command runs the docker image. The newly created processs by
docker run
from your py_app
image is called a container
. -d
runs the image as a daemon and print the container id to your console:$ docker run -it -d -p 8085:8084 py_app
d612ffbd9d560158f1c64997f9a8877243cdf4288c11010298df80b10cfaff5e
-p
exposes the port on your docker file to the port on your host machine. The first port 8085
is the port on yourhost, and the second port
8084
is the port on your docker file.Now to see list of your containers use
docker ps
:docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d612ffbd9d56 py_app "python app.py" 10 minutes ago Up 10 minutes goofy_hopper
From here you can see the ID of your container which is equal to
d612ffbd9d56
. IF you want to have a shell on your container (login into container):
docker exec -it d612ffbd9d56 bash
root@moby:/app#
if you want to connect to the stdout of your container use
attach
, it does not necessary give you a shell:docker attach d612ffbd9d56
*** IF you are attached to a container and press ^c afterward, the container will be stopped.
If you want to stop a container:
$ docker stop d612ffbd9d56
d612ffbd9d56
It prints out container id
d612ffbd9d56
and stop the container. If you enter docker ps
you should not see the container.#docker #commands #docker_part1 #basic #container #devops
What curriculum you are interested in? From now on we will focus more on the specific topics.
Django – 19
👍👍👍👍👍👍👍 58%
Devops (Docker,...) – 7
👍👍👍 21%
Microservice architecture, implementation – 4
👍 12%
Flask – 2
👍 6%
ReactJS – 1
▫️ 3%
👥 33 people voted so far.
Django – 19
👍👍👍👍👍👍👍 58%
Devops (Docker,...) – 7
👍👍👍 21%
Microservice architecture, implementation – 4
👍 12%
Flask – 2
👍 6%
ReactJS – 1
▫️ 3%
👥 33 people voted so far.
I appreciate for the effort you’ve put to incorporate in the poll. As the survey suggests
We would try from the next week to focus more on
We also talk about Docker as a 2nd most voted technology. Don’t worry about it.
As I am a full-time developer I also put other learning materials in the channel too. So be patient. within a month or two you will learn a lot :)
#django #python #docker #podcast #video #toturial
Django
is by far the most voted. We would try from the next week to focus more on
Django
. As many users are at the beginning of the process we’ll try to start from scratch, sorry to say so if you are a senior Django developer :( We also talk about Docker as a 2nd most voted technology. Don’t worry about it.
As I am a full-time developer I also put other learning materials in the channel too. So be patient. within a month or two you will learn a lot :)
BONUS:
we publish videos for some learning materials at the weekend. Thank you all.NOTE:
poll is open. You can still vote.#django #python #docker #podcast #video #toturial
Dear readers,
1st and 2nd part of the basic
1st and 2nd part of the basic
Django
course will be published until 9:00 P.M. ⌚Installation of Django
If you have not yet installed django on your system, install it using the below command:
After installation you can check the validity of the
What does
To see list of
That's it! Welcome to the
#python #django #installation #pip #django_part1
If you have not yet installed django on your system, install it using the below command:
$ sudo pip install django
Password:
Collecting django
Downloading Django-1.11.6-py2.py3-none-any.whl (6.9MB)
100% |████████████████████████████████| 7.0MB 174kB/s
Requirement already satisfied: pytz in /Library/Python/2.7/site-packages (from django)
Installing collected packages: django
Successfully installed django-1.11.6
After installation you can check the validity of the
Django
installation:$ python -m django --version
1.11.6
What does
-m
do in the above command:-m module-name
Searches sys.path for the named module and runs the corresponding .py file as a script.
To see list of
django-admin
subcommands:$ django-admin help
Type 'django-admin help <subcommand>' for help on a specific subcommand.
Available subcommands:
[django]
check
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
makemigrations
migrate
runserver
sendtestemail
shell
showmigrations
sqlflush
sqlmigrate
sqlsequencereset
squashmigrations
startapp
startproject
test
testserver
Note that only Django core commands are listed as settings are not properly configured (error: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.)
That's it! Welcome to the
Django
world. :)#python #django #installation #pip #django_part1
Now that you have installed
Tech C**P enough, let's create the project by issuing the below command (project name:
Suppose our project name is
cd into the folder saturn and issue
Now the overall project looks like:
OK let's run our project and see what's in there (you should be in first
If you have a server listening on port 8000, give your port in front of runserver command as below:
There are some warnings (ignore them at the moment), at the end it is said that project is up and running on port 8000. You can see the output in the next post.
#python #django #runserver #startproject #django_part2
Django
successfully you need to start a project. Django
has a command for project administration called django-admin
, by using it you will be able to create a bare-bone project which includes database configuration, Django-specific options and application-specific settings.Tech C**P enough, let's create the project by issuing the below command (project name:
saturn
):$ django-admin startproject saturn
Suppose our project name is
saturn
you can name it everything you like.cd into the folder saturn and issue
ls
, to see list of files created by django-admin
:$ ls
manage.py saturn
NOTE:
do not call your project name django
or test
or anything that is somehow related to keywords, otherwise there will be conflict between your project and django.NOTE:
the project could live every where inside your server, it is not mandatory to put the code in /var/www/
as old PHP does that. It has the risk of exposing your project code to the wild west (Internet). :)Now the overall project looks like:
saturn/
manage.py
saturn/
__init__.py
settings.py
urls.py
wsgi.py
OK let's run our project and see what's in there (you should be in first
saturn
folder):$ python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
October 27, 2017 - 16:17:10
Django version 1.11.6, using settings 'saturn.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
If you have a server listening on port 8000, give your port in front of runserver command as below:
$ python manage.py runserver 8085
runserver
is a minimal developement-specific server written purely in python
. It reloads itself on code change. In some cases like adding a file does not trigger server reload so you have to restart it manually.There are some warnings (ignore them at the moment), at the end it is said that project is up and running on port 8000. You can see the output in the next post.
NOTE:
some future parts of the project could be in video podcast, it totally depends on your feedbacks and my time.#python #django #runserver #startproject #django_part2
Run a bash in your container:
#docker #exec #bash #container
sudo docker exec -i -t 96885e9e9a51 /bin/bash
96885e9e9a51
is container id. You have to find it yourself by using the below command:docker ps -a
#docker #exec #bash #container
Pass arguments to
If you want to pass multiple arguments to
Now initiate your args inside of
#docker #container #build_arg #argument #build #image
Dockerfile
when you build it using --build-arg
in order to have greater flexibility on docker build:docker build -t essearch/ess-elasticsearch:1.7.6 --build-arg SHARDS_NO=5
If you want to pass multiple arguments to
Dockerfile
give another --build-arg
and give your second argument as above.Now initiate your args inside of
Dockerfile
as below:ARG SHARDS_NO=""
#docker #container #build_arg #argument #build #image