This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # inside the script we should have something like below: | |
| def run(*script_args): | |
| print (script_args) | |
| # from the shell when calling the script to run use the --script-args to pass in arguments and they will be recieved as tuples inside the script | |
| #-> example: python manage.py runscript myscript --script-args Testing 123 | |
| will return ('Testing','123') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| So how can I question a variable that is a NoneType? | |
| Use is operator, like this | |
| '' | |
| if variable is None: | |
| '' | |
| Why this works? | |
| Since None is the sole singleton object of NoneType in Python, we can use is operator to check if a variable has None in it or not. | |
| Quoting from is docs, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| So how can I question a variable that is a NoneType? | |
| Use is operator, like this | |
| '' | |
| if variable is None: | |
| '' | |
| Why this works? | |
| Since None is the sole singleton object of NoneType in Python, we can use is operator to check if a variable has None in it or not. | |
| Quoting from is docs, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| So how can I question a variable that is a NoneType? | |
| Use is operator, like this | |
| '' | |
| if variable is None: | |
| '' | |
| Why this works? | |
| Since None is the sole singleton object of NoneType in Python, we can use is operator to check if a variable has None in it or not. | |
| Quoting from is docs, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| After installing postgreSQL and rebooting Mint when recieved I would recieve the following error saying can't start postgres | |
| while trying to run Django | |
| could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain | |
| socket “/var/run/postgresql/.s.PGSQL.5432”? | |
| sudo mkdir /var/log/postgresql | |
| sudo chown postgres.postgres /var/log/postgresql | |
| sudo su postgres | |
| touch /var/log/postgresql/postgresql-9.1-main.log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # create a bakup: | |
| sudo su - postgres | |
| pg_dump postgres > postgres_db.bak | |
| # options: | |
| pg_dump -U user_name -h remote_host -p remote_port name_of_database > name_of_backup_file |
NewerOlder