Understanding CloudBolt’s Errors

Problem Scenario
In CloudBolt (the Cloud Management Platform), you run a job to create a server.  The job stops progressing.  The GUI shows "Failed Order ... provisioning nameOfServer" with a bar that has the left most 5% red and the rest of the 95% gray.  What do you do to create the server?

Answer
The server may be created; there may have been a small error when the job ran.  CloudBolt's error messages can be cryptic.  Depending on the configuration, the server could have been deleted.  But that is not necessarily the outcome associated with the error described in the "Problem Scenario."  Go to the underlying hypervisor (e.g., VMware) and see if a server was created to your specifications.

How To Resolve “Certificate_Verify_Failed” error when trying an AWS CLI command?

Problem Scenario  You try to use an AWS CLI command, but you get an error.  The error says "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:...)"

Possible solutions

#1  Redo the AWS configuration.  Issue this command: aws configure
Leave the AWS Access Key ID and the AWS Secret Access Key the way they are.  Look at the "Default region name."  Verify there is no letter at the end.  For example, make sure it is us-west-1, us-west-2, or us-east-1.  Letters at the end of the zone name may appear in the "Availability Zone" in the AWS Console or the results of a describe-instances command on a working installation of AWS CLI.  However, you must truncate the letter for the purposes of configuring the AWS CLI if you are getting errors such as the one listed above.  (If you want to reinstall the AWS CLI, see this posting.)

#2  If the problem is not that there is a letter at the end of the availability zone, try to uninstall certifi and reinstall it with a specific version.  Assume the root user, then try these commands:
pip uninstall certifi
pip install certifi==2015.04.28

If pip is not installed, see this posting. As a reminder for AWS instances, "ec2-user" is the default user for RHEL and SUSE Linux.  For AWS instances, "ubuntu" is the default user for Ubuntu Linux.

If you need assistance installing pip, see the following links depending on your version of Linux:

Python Quiz

(For the DevOps and ETL Quiz, click here.)

Python Quiz

1.  What is an iterator in Python?

A)  A stream of data that is manipulated or interacted with as an object.
B)  A function that returns a namespace.
C)  A module of nested objects.
D)  A function that returns packages.

2.  Which module in Python allows you to translate strings to and from binary formats?

A)  Marshal
B)  Shelve
C)  Pickle
D)  DMAC

3.  Which of the following is a Rich Internet Application toolkit?

A) binascii
B) shelve
C) pyjamas
D) alglib

4.  Which of the following provides an interface to AWS?

A) binascii
B) botocore
C) sndhdr
D) xdrlib

5.  How does Python store an error?

A)  As a static variable inside the interpreter
B)  It normally uses an operating system environmental variable.  But if there were too many arguments, it writes to a buffer outside the interpreter.
C)  Inside a pseudo class file (.pyc) in /tmp/
D)  It raises the error to the exception logger outside of the interpreter
E)  In the internal sqlite database

6.  What does the yield keyword do in Python?

A)  It is a CPython mechanism to synchronize threads.
B)  A reserved word to control the flow of execution to support conditional logic with Python generators.
C)  A reserved word that pauses a function from parsing named tuples
D)  It sets null points to evaluate as zeroes in arithmetic operations.

7.  Which of the following can allow for non-destructive testing of whether an exception has been set?

A)  pyyaml and pypy modules
B)  PyErr_Config()
C)  PyErr_Clear()
D)  PyErr_Occurred()

8.  If you are receiving an error with a Python program that attempts to connect to a network resource with SSL, there is a way to avoid an error.  This error is '"SSL: CERTIFICATE_VERIFY_FAILED" Error' 
One workaround involves these two lines of Python code:

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

Which of the following most nearly addresses the two-line solution:

A)  The solution makes the Python program more secure.
B)  The solution makes use of the sys library.
C)  The solution is very inadvisable.
D)  The solution would never work.

9.  What is a generator in Python?

A)  Any class that is a factory design pattern.
B)  A reserved word that is a parent class of all iterators in the program.
C)  An object that controls the CPU of the Python Just-In-Time compiler.
D)  A function that has a yield statement and returns an iterator.

10.  Which two of the following add to thread safety in Python (so different threads do not modify data to have unexpected results)?

A)  metaclass
B)  global interpreter lock
C)  trash collection
D)  overwatch
E)  duck-typing
F)  lbyl
G)  lambda
H)  list comprehension
I)  Pythonic sequence
J)  object slice

11.  When trying to install pycrypto you run this:

python setup.py build

and you receive an error like this "warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath." What does it mean?

A) You cannot proceed with installing pycrypto; the installation has been aborted.
B) You can proceed with installing pycrypto; the installation may still work.
C) You have a Python Fabric vulnerability
D) A German edition of pycrypto was already installed and you may or may not be able to proceed.

12.  How do you find the version of Tornado (python-tornado) on a RedHat server?

A)  python
>>> print python-tornado.version_info

B)  python
>>> import tornado
>>> print tornado.version_info

C)  which python-tornado

D)  python-tornado --version

13.  What does GIL stand for?

A)  Gears Interpreting Language
B)  Good Invention Language
C)  Global Interpreter Lock
D)  Generate Interprocess Loquitur
E)  Global Instant Lookup

14.  Where does the "kw" come from or mean in the **kwargs you see in Python error messages and/or code?

A)  kilowatt (wildcard kilowatt arguments)
B)  You hear stars on the radio.  Radio stations on the West Coast of the U.S. traditionally have call signs that start with the letter "k," and radio stations on the East Coast have call signs that start with the letter "w."  For a radio button to appear in a GUI written in Python, there needs to be arguments. 
C)  keyword
D)  keep working

15. How many different directory locations does the "import" command look to for a .py file when invoked?

A) 0
B) 1
C) 2
D) Often several but it depends

16. True or False? A function in Python has to have a return statement.

17. What is a common way (as of 2019) to start a new thread in Python assuming the proper module has been imported? Choose two.

A) nameofthread = Thread(nameoffunction)
B) nameofthread = start_new(nameoffucntion)
C) thread.start_new(nameoffunction)
D) thread.start_new_thread(nameoffunction)
E) nameofthread = newthread()

18. What percentage of data types and classes in Python are objects?

A) 0%
B) 25%
C) 50%
D) 75%
E) 100%

19. What is a function decorator in Python?

A) A function that uses a function as a parameter and returns a function with a special @ syntax.
B) A function that uses a function as a parameter and returns a function with a special ^ syntax.
C) An anonymous function that passes along parameters.
D) A library module that enhances GUI Python programming.
E) A library module that obfuscates system functions programming.

20. What is the recommended way of calling subprocesses in Python 3?

A) Using the os.exec function.
B) Using the os.spawn function.
C) Using the subprocess.open function.
D) Using the subprocess.run() function.

21. Without "import re" using Python 3, can you use the .find() method to match a pattern in a string?

A) Yes
B) No
C) It depends

22. Which of the following is true about Python class names?

A) It is mandatory that a class name's first letter be uppercase.
B) It is mandatory that a class name's first letter be lowercase.
C) It is recommended that a class name's first letter be uppercase.
D) It is recommended that a class name's first letter be lowercase.

23. What is a way to implement a hash table with Python?

A) a nested list
B) a list of tuples
C) a dictionary
D) a nested dictionary
E) all of the above
F) none of the above

24. To use a class in Python, what is necessary?

A) The init() function needs to be present.
B) An encapsulated function with the syntax of two leading two underscores __
C) Have an indented block underneath the class definition.
D) Use the class keyword.

25. Items in a Python set {} have which of the following traits? Choose all that apply.

A) Unindexed
B) Ordered
C) Immutable
D) Potentially a duplicate of another item in a set

26. Where are variables stored? Choose all that apply.

A) In the heap if they are local variables
B) In the heap if they are global variables
C) In the stack if they are local variables
D) In the stack if they are global variables

27. Of the following, when should there be space after an equals sign "="?

A) When there is an equivalence test
B) When there is an initialization of an unannotated function parameter
C) When there is a variable assignment involving a reserved word in Python
D) All of the above
E) None of the above

28. There is no difference between an array and a list in Python. True or False?

29. What is a namedtuple? Choose the best answer.

A. A tuple with a variable name.
B. A tuple that is not indexed by integers but by attribute/key "strings."
C. A tuple that is indexed by integers and has values accessible via attribute/key "strings".
D. None of the above.

30. For concurrency to work in multiuser programs, which is less expensive?

A. Multithreading
B. Multiprocessing
C. Using the GIL
D. None of the above.

31. What does this code return?

def fun_func(n):
  return lambda a : a * n

tripler = fun_func(3)

print(tripler(15))

A. An error about tripler not accepting parameters.
B. An error about fun_func needing an additional parameter
C. 45
D. None of the above.

32. What does the third line print?

>>> sample_list = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
>>> new_list = sample_list[:]
>>> new_list

A. []
B. ['a', 'b', 'c', 'd',]
C. ['e', 'f', 'g', 'h']
D. ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']

33. What does divmod(3, 6) return in Python?

A. 2
B. (0, 2)
C. (2, 0)
D. None of the above

34. What does the second line print?

sample_list = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
sample_list[:2]

A. ['a', 'b']
B. ['h', 'i']
C. ['d', 'e', 'f', 'g', 'h', 'i']
D. None of the above

35. What does the second line print?

sample_list = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
sample_list[3:]

A. ['a', 'b']
B. ['a', 'b', 'c']
C. ['d', 'e', 'f', 'g', 'h', 'i']
D. None of the above

36. What is an f-string in Python? Choose the best answer.

A. A format string specified by an "f" that uses variable substitution with {this_type} of syntax
B. A reserved word in Python for a formatted string
C. A special string variable that is mutable
D. Text enclosed in quotes near the definition of a method or class to allow a programmer to document what the method or class does
E. All of the above
F. None of the above.

37. The isspace method looks for which of the following?

A. One or more spaces
B. Tab characters
C. New lines
D. All of the above
E. None of the above

38. Which of the following is a class-related method that Python supports?

A. Class
B. Instance
C. Static
D. All of the above
E. None of the above.

39. What is metaclass in Python?

A. A keyword referring to the __doc__ (aka doc strings) of a class
B. A keyword referring to the attributes of a class
C. Not a keyword, but a concept referring to the "dunder attribute" __attr__
D. None of the above

40. When are Python decorators executed?

A. Compile time
B. Run time
C. Both of the above
D. None of the above

41. What does MRO stand for?

A. Maintenance Repair Operations
B. Method Resolution Order
C. Metadata Resolve Operate
D. None of the above

42. What does Enum do in Python?

A. It is a reserved word that creates a list of tuples from 1 until the last number.
B. It is a built-in class whose objects are numbered starting at 1.
C. It is a module that can be imported to facilitate creating objects of a class.
D. None of the above.

43. What is the #! pattern called in Python?
___________________________________

44. What does doc do with a programmer-defined Python object? Choose the best answer.

A. It can display help information from the Python interpreter.
B. It prints the comments of a given object.
C. It prints the comments of a given object (but only those in the top-most comment designated by quotes).
D. None of the above

45. Consider this code:

import random

neat_list = ["dog", "cat", "hamster"]
random.shuffle(neat_list)

What does random.shuffle(neat_list) do?

A. It does an in-place re-arrangement of the neat_list.
B. It returns a deep copy of a randomized version of neat_list.
C. Both of the above.
D. None of the above.

46. To read a file you might use something like this:

open('foobar.txt', 'r')

Instead of the "r", what might you use to add text to a file?

A. a
B. w
C. Both of the above
D. None of the above

47. What does the "\t" signify in Python?

A. It is the syntax to place a given numeric string into a time data type.
B. It is a reference to a tab (e.g., for Python to recognize in a file).
C. It signifies a carriage return (e.g., for printing).
D. This two-character string has no special meaning.

48. What does the caret symbol do in the context of a regex statement as follows?

import re
sample = "Very nice"
result = re.search("^Very", sample)

A. The caret symbol finds strings that do not have "Very"
B. The caret symbol finds strings that end with "Very"
C. The caret symbol finds strings that start with "Very"
D. None of the above

49. What is the difference between a keyword and a built-in?

A. Keywords are part of modules that are imported, but built-ins work without any import statement.
B. Built-ins are part of modules that are imported, but keywords work without any import statement.
C. keywords are set by the user; they are not reserved words.
D. None of the above.

50. How is index() different from find() in Python?

A. find() returns a Boolean (True or False) while index() returns an integer value
B. find() returns a string while index() returns an integer value
C. when the pattern is not found, they return different things
D. There is no difference.

51. What is a quick way to return the key associated with the dictionary item that is the highest value?

A. max(name_of_dictionary, key=name_of_dictionary.get)
B. max(name_of_dictionary.items())
C. max(name_of_dictionary.values)
D. None of the above

52. What is the value of int(True) ?

A. 0
B. 1
C. It would produce a command not found error.
D. None of the above.

53. How do you create an empty set in Python?

A. Use syntax like this: foobar = {}
B. Use syntax like this: foobar = set()
C. Use syntax like this: foobar = set.empty()
D. None of the above

54. Complete the following sentence as an answer to the question, how does the Python "any" key word work?

"It accepts an iterable..."

A. and returns a random value from the iterable.
B. and a variable and returns "True" if the variable is in the iterable but it returns False if the variable is not in the iterable.
C. and returns "False" if every element is a zero or an empty string, where a space is considered not empty; otherwise it returns True.
D. and returns "False" if every element is a zero or an empty string, where a space is considered empty; otherwise it returns True.
E. and returns True if any of the variables in the iterable are True but it returns False if every variable is False.
F. and returns the first variable.

55. What does this code snippet print?

def cool_func(var1, var2):
    sum_vars = var1 + var2 + var3
    return sum_vars

var3 = 100
x = cool_func(2, 7)
print(x)

A. Nothing.
B. "9"
C. "NameError: name 'var3' is not defined"
D. "109"

56. How is global different from nonlocal?

A. They are functionally equivalent.
B. You need to import sys for nonlocal statements to work.
C. nonlocal applies to functions inside of functions but does not affect variables' values outside of any function. global affects values outside of any function.
D. none of the above.

57. When you are not using Classes in Python, how much of the code relies on modules?

A. 0%
B. Usually about 50%
C. 100%
D. Not enough information to decide; it depends.

58. What happens when you try to add a duplicate entry to a set in Python?

A. With the .append() syntax or with the .add() syntax the duplicate entry will be added.

B. With the .append() syntax the program will stop processing and an error will show but with the .add() syntax nothing will happen (and the entry won't be added).

C. With the .append() syntax nothing will happen (and the entry won't be added) but with the .add() syntax the program will stop processing and an error will show.

D. Nothing will happen with either .append() syntax or with the .add() syntax, and the duplicate entry will be not added.

59. How do you add an item to a list in the first position (instead of the last)?

A. appendleft()
B. insert()
C. prepend()
D. create a new temporary list with the item you want and combine it with the original list
E. none of the above

60. What is the difference between a method and a function?

A. There are no functions in Python.
B. There are no methods in Python.
C. Functions are custom-designed whereas methods are built-in.
D. Methods are custom-designed whereas functions are built-in.
E. Methods are associated with classes or objects whereas functions are not.
F. Functions are associated with classes or objects whereas methods are not.

61. What went wrong when you print the output of a variable, but you see something like this?

<built-in method strip of str object at 0x7fc87bf4a0f0>

A. You forgot to compile a program into a .pyc file.
B. You forgot to use parentheses "()".
C. You combined a built-in Python reserved word with your own function.
D. None of the above.

62. What is a docstring in Python?

A. Text enclosed in quotes near the definition of a method or class to allow a programmer to document what the method or class does.
B. A reserved word in Python for a formatted string
C. A special string variable that is mutable
D. All of the above
E. None of the above.

63. What is the difference between pass and continue?
_______________________________________

64. What type of data structure is a map?

A. A dictionary
B. A non-dictionary key-value store
C. An ordered dictionary
D. A list
E. A tuple
F. A set
G. None of the above

65. Which of the following evaluate negative integers (e.g., a string of -1) to see if it is a number?

A. isdecimal
B. isnumeric
C. isdigit
D. All of the above
E. None of the above

*** For answers, see this link. ***

The Apparent Story Behind OpenStack Component Log File Names

AWS used to have a separate API package from their CLI package; now the two are the same.  OpenStack components' command line interface activity is captured in a log when proper thresholds are set (e.g., nova.conf, glance.conf etc.) and later met.  CLI activity (which bypasses Horizon) as well as GUI API activity (e.g., mouse clicks on buttons in Horizon) is written to a file named api.log.  The location of this api.log file follows this convention: /var/log/OpenStackComponentName/api.log (where "OpenStackComponentName" is nova, neutron, glance, or swift, etc.).

The maker of the preeminent F5 load balancer has a corresponding technical cyber community named DevCentral.  One of the cofounders of this community, Jeff Browning, believes there is a salient difference between the CLI and API technologies.  (You can read his article here.)   Taking Glance as an example, it seems that he would disagree with OpenStack naming the Glance log api.log when it captures Glance CLI activity. 

On the other hand, enterprise, TCP/IP networking author Ivan Pepelnjak views APIs and CLIs as very similar concepts.   (See this link for Pepelnjak's opinions on similarities between APIs and CLIs.)  It appears that he may agree with the design of OpenStack and naming the log api.log when it captures CLI activity as well as API activity for a given OpenStack component.  So maybe the short name api.log is better than a compound word like api-cli.log.  Logging to one file can allow for greater centralization of logs which can aid troubleshooting for often unruly technologies like components of OpenStack.

Apparently there is a reason that the OpenStack foundation has file with the name api.log capture CLI and API activity.  According to OpenStack Operations Guide, written by Fifield, Fleming, Gentle, Hochstein, Proulx, Towes, and Topjian and published in May of 2014, there are plans to eliminate CLIs from bypassing the APIs.  Command line tools will eventually invoke API-based tools (along with Horizon).  Right now, the CLI commands can bypass API endpoints.  Knowing that API-based commands will be used for all OpenStack operations should eliminate the confusion about the name of the log files.

How To Install Docker on an AWS Instance of RedHat Linux

Update on 11/20/20: We recommend you see How Do You Install the docker.service File on RHEL 8.x? instead of the directions below. (Many times this command will work: sudo yum -y install docker )

Update on 9/10/19: These directions below work to install Docker version 17.05.0-ce on RHEL 8.x.

These "directions" to install Docker on RedHat Enterprise Linux include a script and how to run it.  The script was designed to install Docker 1.12 on an AWS instance of RHEL 7.x.  This script requires that your AWS RHEL server is in a security group that has access to the Internet.  The script takes approximately 10 minutes to run.  But bandwidth and resources on your instance may vary.  The benefit of these directions is that they will work when you may not run the "yum-config-manager" command.  The script below uses CentOS packages which are not ideal for RHEL.  If you can run the "yum-config-manager" command, see these alternative directions.  (If you want a variety of different directions for installing Docker, please see this posting.)

Step #1  Log in and become root.
Step #2  Run these commands:

cd /tmp/
touch installer.sh
chmod u+x installer.sh
vi installer.sh 
 #then paste everything below up to and including the 'echo "docker run -it centos /bin/bash"' line

#!/bin/bash
#Written by continualintegration.com
yum -y update
echo '
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg' > /etc/yum.repos.d/docker.repo
yum -y install docker-engine
groupadd docker
usermod -aG docker ec2-user
service docker start
echo "run 'docker run hello-world' to test it out"
echo "Afterward, you can run "
echo "docker run -it ubuntu bash"
echo "or you can run"
echo "docker run -it centos /bin/bash"
echo "Log out and log back in"

Step #4  Save the file.
Step #5  Run the script with a command like this: ./installer.sh
Step #6  Test it with a command like this:  docker run hello-world
(You may need to log out and log back in.  Instead of the "chmod" command above, you could run it with "sudo bash".)
Step #7 Enter a docker container with a command like this:  docker run -it centos /bin/bash

(If you want to install Docker on a RHEL VM running in GCP, see this posting.)

We recommend you see How Do You Install the docker.service File on RHEL 8.x? instead of the directions above.

How To Install Docker on an AWS Instance of Ubuntu

Updated 12/26/18
Problem scenario

You want to install Docker.  You can make changes to the Ubuntu Linux repositories so you can use apt-get to install it.  How do you install Docker on an AWS EC-2 instance?

Solution
There is an alternative set of directions if you click on this link here (if you would prefer not to configure the apt-get repositories).  These directions below to install Docker on Ubuntu Linux include a script and how to run it (but the script below will make a change to the repositories that the Linux server uses).  The script was designed to install Docker 1.12 on an AWS instance of Ubuntu 14.04, 16.04 or 18.04.  These directions assume that the user that will run Docker commands is named "ubuntu"; the "usermod" stanza associates this user with the group named "docker".  Please note that these directions do work for installing Docker on an Azure instance of Ubuntu too!  For AWS this script requires that your Ubuntu Linux server is in a security group that has access to the Internet.  The script takes approximately three minutes to run in AWS.  It may or may not take longer in Azure.  Bandwidth and resources on your instance may vary.  (If you want a variety of different Docker installation directions, see this posting.)

Step #1  Log in and become root.
Step #2  Run these commands:

cd /tmp/
touch installer.sh
chmod u+x installer.sh   # 
this is unnecessary if you prefer to run the script with the "sudo bash installer.sh" command
vi installer.sh

Step #3  Enter this text into the file from "#!/bin/bash" (the first line) to the line '"echo "docker run -it ubuntu bash""' (the last line):

#!/bin/bash
apt-get update
apt-get install -y apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' > /etc/apt/sources.list.d/docker.list
echo 'deb http://cz.archive.ubuntu.com/ubuntu trusty main' >> /etc/apt/sources.list.d/docker.list
apt-get update
apt-cache policy docker-engine
apt-get --assume-yes install linux-image-extra-$(uname -r) linux-image-extra-virtual
apt-get --assume-yes install docker-engine
sudo service docker start
sudo groupadd docker
sudo usermod -aG docker ubuntu
docker run hello-world
echo "Try running this command below to enter a Docker container:"
echo "docker run -it ubuntu bash"

Step #4  Save the changes. 
Step #5  Run the script (./installer.sh).  (An alternative way is to use "sudo bash installer.sh".)
Step #6  If you ran the above script when you were logged in with the "ubuntu" username, you will need to log out and log back in.  Otherwise start a new terminal session with the "ubuntu" user. Then run this command with no quotes to enter the Docker container:  "docker run -it ubuntu bash"

What is TCP port 8080 typically used for?

Question
What is TCP port 8080 typically used for?

Answer
Jenkins, Docker, NodeJS, Apache Ambari, Apache Marathon, Apache Tomcat, Amazon Web Services' Elastic Load Balancer, JBoss Application Server, GitLab, M2MLogger (remote monitoring), InfoSphere BigInsights Console (IBM's proprietary Hadoop and Spark solution), JasperReports (because of Apache Tomcat), remote management of physical routers, and enterprise network proxy services all commonly use port 8080. 

In part, taken from Learning AWSreference.com, Adobe's website (the old website was http://help.adobe.com/en_US/livecycle/9.0/securityHardening.pdf), Jaspersoft's website, and IBM's website (http://www.ibm.com/support/knowledgecenter/SSPT3X_2.1.2/com.ibm.swg.im.infosphere.biginsights.install.doc/doc/c0057855.html).

AWS S3 Problem: “The specified key does not exist.” How do you solve this?

Problem scenario:  You are trying to upload a file to S3 but get an error.  You use a command like this:
curl -T /path/to/sourcefile.java http://s3.amazonaws.com/my.bucket/sourcefile.java
You get an error in XML that includes "The specified key does not exist."

Solution:  Check the path to your source file.  Verify your source file is there with the name you expect it to be.

How Do You Troubleshoot the Error “eve.exceptions.ConfigException: DOMAIN dictionary missing or wrong.”?

Problem scenario
You are trying to use Python Eve.  You are using Python's interactive command prompt, and you run these two commands:

from eve import Eve
app = Eve()

But you get this error:

"File "/usr/local/lib/python2.7/dist-packages/eve/flaskapp.py", line 138, in __init__
    self.validate_domain_struct()
  File "/usr/local/lib/python2.7/dist-packages/eve/flaskapp.py", line 269, in validate_domain_struct
    raise ConfigException('DOMAIN dictionary missing or wrong.')
eve.exceptions.ConfigException: DOMAIN dictionary missing or wrong."

What should you do?

Solution
Run these three commands instead of the two above:

contint = {'MONGO_HOST': 'localhost', 'MONGO_PORT': 27017, 'MONGO_DBNAME': 'the_db_name', 'DOMAIN': {'contacts': {}}}
from eve import Eve
app = Eve(settings=contint)

# Now you can run app.run()

We based this solution from this page.