Deploying to new DigitalOcean Droplet

310 views
Skip to first unread message

Data Intelligence

unread,
May 25, 2018, 9:19:34 PM5/25/18
to Mezzanine Users
Hi,
I've spent two days trying to get past this issue of deployment.

I'm following the tutorial which is straight forward on the site but can't get past fabric

Here is the content of my requirements.txt:
asn1crypto==0.24.0
bcrypt==3.1.4
beautifulsoup4==4.6.0
bleach==2.1.3
certifi==2018.4.16
cffi==1.11.5
chardet==3.0.4
cryptography==2.2.2
Django==1.10.8
django-contrib-comments==1.8.0
fabric==2.0.1
filebrowser-safe==0.4.7
future==0.16.0
grappelli-safe==0.4.7
html5lib==1.0.1
idna==2.6
invoke==1.0.0
Mezzanine==4.2.3
oauthlib==2.0.7
paramiko==2.4.1
Pillow==5.1.0
pyasn1==0.4.2
pycparser==2.18
PyNaCl==1.2.1
pytz==2018.4
requests==2.18.4
requests-oauthlib==0.8.0
six==1.11.0
South==1.0.2
tzlocal==1.5.1
urllib3==1.22
webencodings==0.5.1

I am aware that I have to install other dependencies for Ubuntu which I already did but I can't get out of my own desktop yet:

1- I have a new droplet on DO
2- Created new user
3- Edited my local_settings.py
4- Uncommented all the relevant lines in fabfile.py
5- From my command prompt, inside venv ran fab secure

Error 1: No module named fabric.api
Spent few hours researching to find out it has been replaced with
"from fabric import Connection"

6- run fab secure again and now I get
Error: No module named fabric.context_managers...
so I commented that line and sure enough new error for the next line and on and on so now my fabfile.py is not so fabulous after all and looks like this, well just the beginning of it anyways because if I can't get past the first few lines I have no use nor the time of doing this for 2 more days:

from __future__ import print_function, unicode_literals
from future.builtins import open

import os
import re
import sys
from contextlib import contextmanager
from functools import wraps
from getpass import getpass, getuser
from glob import glob
from importlib import import_module
from posixpath import join

from mezzanine.utils.conf import real_project_name
from fabric import Connection
# from fabric.api import abort, env, cd, prefix, sudo as _sudo, run as _run, \
    # hide, task, local
# from fabric.context_managers import settings as fab_settings
# from fabric.contrib.console import confirm
# from fabric.contrib.files import exists, upload_template
# from fabric.contrib.project import rsync_project
# from fabric.colors import yellow, green, blue, red
# from fabric.decorators import hosts


################
# Config setup #
################

if not hasattr(env, "proj_app"):
    env.proj_app = real_project_name("blog_iq")

conf = {}
if sys.argv[0].split(os.sep)[-1] in ("fab", "fab-script.py"):
    # Ensure we import settings from the current dir
    try:
        conf = import_module("%s.settings" % env.proj_app).FABRIC
        try:
            conf["HOSTS"][0]
        except (KeyError, ValueError):
            raise ImportError
    except (ImportError, AttributeError):
        print("Aborting, no hosts defined.")
        exit()


env.db_pass = conf.get("DB_PASS", None)
env.admin_pass = conf.get("ADMIN_PASS", None)
env.user = conf.get("SSH_USER", getuser())
env.password = conf.get("SSH_PASS", None)
env.key_filename = conf.get("SSH_KEY_PATH", None)
env.hosts = conf.get("HOSTS", [""])

env.proj_name = conf.get("PROJECT_NAME", env.proj_app)
env.venv_home = conf.get("VIRTUALENV_HOME", "/home/%s/.virtualenvs" % env.user)
env.venv_path = join(env.venv_home, env.proj_name)
env.proj_path = "/home/%s/mezzanine/%s" % (env.user, env.proj_name)
env.manage = "%s/bin/python %s/manage.py" % (env.venv_path, env.proj_path)
env.domains = conf.get("DOMAINS", [conf.get("LIVE_HOSTNAME", env.hosts[0])])
env.domains_nginx = " ".join(env.domains)
env.domains_regex = "|".join(env.domains)
env.domains_python = ", ".join(["'%s'" % s for s in env.domains])
env.ssl_disabled = "#" if len(env.domains) > 1 else ""
env.vcs_tools = ["git", "hg"]
env.deploy_tool = conf.get("DEPLOY_TOOL", "rsync")
env.reqs_path = conf.get("REQUIREMENTS_PATH", None)
env.locale = conf.get("LOCALE", "en_US.UTF-8")
env.num_workers = conf.get("NUM_WORKERS",
                           "multiprocessing.cpu_count() * 2 + 1")

env.secret_key = conf.get("SECRET_KEY", "")
env.nevercache_key = conf.get("NEVERCACHE_KEY", "")

if not env.secret_key:
    print("Aborting, no SECRET_KEY setting defined.")
    exit()


# Remote git repos need to be "bare" and reside separated from the project
if env.deploy_tool == "git":
    env.repo_path = "/home/%s/git/%s.git" % (env.user, env.proj_name)
else:
    env.repo_path = env.proj_path


=========================================

Well now you can imagine what the next error is going to be, RIGHT!
NAMEERROR: name 'env' is NOT DEFINED  well of course is not defined, so can someone tell me why is this file created to begin with if I just installed 2.0.1 and the file created is OUTDATED already??

DO I punt and move on with my life or have a beer or both?

If anyone can help it would be appreciated, maybe I'll send you the beer.

Thanks

Ken Bolton

unread,
May 25, 2018, 9:45:25 PM5/25/18
to mezzanine-users
Install Fabric version 1, not 2.

--
You received this message because you are subscribed to the Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

carlos

unread,
May 25, 2018, 10:15:36 PM5/25/18
to mezzani...@googlegroups.com
install fabrinc in your local and server same version!!

To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
att.
Carlos Rocha

Data Intelligence

unread,
May 25, 2018, 10:46:01 PM5/25/18
to Mezzanine Users
Even though the instruction on Mezzanine site explicitly state:
"The easiest method is to install directly from pypi using pip by running the command below, which will also install the required dependencies mentioned above:
pip install mezzanine"

which I did and it automatically installed fabric 2....

I thought of that and uninstalled fabric and tried to pip install fabric==1 and sadly got this error:

Collecting fabric==1
  Using cached https://files.pythonhosted.org/packages/66/62/38977ae8dfeeed62787ac893821f2a5be5454dc37934d72871c622feb5db/Fabric-1.0.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\~\AppData\Local\Temp\pip-install-gsu3w7_s\fabric\setup.py", line 7, in <module>
        from fabric.version import get_version
      File "C:\~\AppData\Local\Temp\pip-install-gsu3w7_s\fabric\fabric\version.py", line 95
        raise TypeError, '"%s" is not a valid form specifier.' % form
                       ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\~\AppData\Local\Temp\pip-install-gsu3w7_s\fabric\

Data Intelligence

unread,
May 25, 2018, 10:49:15 PM5/25/18
to Mezzanine Users
Carlos, I haven't installed anything on the remote server except the basic pip.. and the other dependencies stated on Mezzanine site once again:

"

Users on Debian or Ubuntu will require some system packages to support the imaging library:

$ apt-get install libjpeg8 libjpeg8-dev
$ apt-get build-dep python-imaging"

and per instructions fabric is supposed to install whatever fabric is in my requirements.txt file IF I can get past my issues stated earlier.
To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
att.
Carlos Rocha
Message has been deleted

Thomas Bates

unread,
Jul 4, 2018, 4:38:12 PM7/4/18
to Mezzanine Users
Did you ever find a sollution to this?  I am following a similar guide.  I was able to install fabric==1, but I then get a separate error:

Traceback (most recent call last):
  File "/root/mezzanineEnv/local/lib/python2.7/site-packages/fabric/main.py", line 460, in main
    docstring, callables = load_fabfile(fabfile)
  File "/root/mezzanineEnv/local/lib/python2.7/site-packages/fabric/main.py", line 132, in load_fabfile
    imported = __import__(os.path.splitext(fabfile)[0])
  File "/root/mezzanineEnv/thirdrail/fabfile.py", line 16, in <module>

    from fabric.api import abort, env, cd, prefix, sudo as _sudo, run as _run, \
ImportError: cannot import name task

Can anyone offer some suggestions here?  Thanks,

Eduardo Rivas

unread,
Jul 4, 2018, 5:08:46 PM7/4/18
to mezzani...@googlegroups.com

Try pip install “fabric<2”

 

You want the latest version on 1.X, not 1.0 per se.

Reply all
Reply to author
Forward
0 new messages