exit psql terminal
exit psql terminal
1 | \q
|
Discover code snippets, tutorials, and programming insights
exit psql terminal
1 | \q
|
<p>Usefull django packages</p>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | pandas
jupyter
bottleneck
numexpr
matplotlib
numpy
ujson
ijson
babel
six
wheel
pillow
ipython
mypy
beautify
autopep8
pylint
python-language-server
flake8
pylama
pylama-pylint
sorl-thumbnail
python-memcached
gunicorn
psycopg
psycopg2-binary
django
pylint-django
djangorestframework
djangorestframework-simplejwt
djangorestframework-datatables
django-cors-headers
django-filter
django-uuslug
django-mptt
django-debug-toolbar
django-extensions
django-admin-sortable2
django-redis
sorl-thumbnail
celery
django-celery
django-redis-cache
redis
django-cache-machine
scrapy
scrapy-djangoitem
|
Backup and restore postgresql database
1 2 3 4 | <h2>backup postgresql</h2>
pg_dump -U user-name -d source_db -f dumpfilename.psql
<h2>restore postgresql</h2>
psql -U user-name -d desintation_db -f dumpfilename.sql
|
Ajax jquery
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | (function($){
$(document).ready(function(){
$('#id_form').on('submit', function(e){
e.preventDefault();
$.ajax({
url: $(this).attr('action'),
method: $(this).attr('method'),
data: $(this).serialize(),
datatype: 'json',
success: function(response){
$('.result').html('');
var data = eval(response);
for (var key in data) {
if (data.hasOwnProperty(key)) { // this will check if key is owned by data object and not by any of it's ancestors
$('.result').append(key + ':' + data[key] + '</br>'); // this will show each key with it's value
}
}
}
});
});
});
})(jQuery)
|
Install virtualenv with venv and python3
1 2 3 | sudo apt-get install python3-venv
python3 -m venv virtualenv
source virtualenv/bin/activate
|