VOSEQ server start

####

[shenzy@LFE0530 VoSeq-2.1.1]$ source /usr/bin/virtualenvwrapper.sh
[shenzy@LFE0530 VoSeq-2.1.1]$ workon voseq_environment
(voseq_environment) [shenzy@LFE0530 VoSeq-2.1.1]$

python voseq/manage.py runserver –settings=voseq.settings.local 143.89.29.80:8000

 

setup environmental variables, virtual environments

Wai-Yin Kwan edited this page on Jul 5, 2015 · 12 revisions

When developing and deploying a web app, different environments (local machine, live site) need different configurations (passwords, database names, etc). We can use environmental variables to setup the different environments. Here are two options to set up environmental variables: easy way with autoenv or harder way with virtualenvwrapper.

You need to use a text editor to edit these files. In this demo, I’m using atom, but you can use any text editor.

Easy way using autoenv

Part 1. Only do this once.

  1. Download autoenv.
$ git clone git://github.com/kennethreitz/autoenv.git ~/.autoenv

$ echo 'source ~/.autoenv/activate.sh' >> ~/.bashrc

Part 2. Do this for every project.

  1. create .env file in the root directory of the project.
$ cd <path/to/project>

$ touch .env

open the .env file.

$ atom .env

Put environmental variables into the .env file, then save the file.

export VARIABLE_NAME="value"

  1. reload shell
 source ~/.bashrc
  1. type y when you will see a message like:
autoenv: This is the first time you are about to source /path/.env:

autoenv: Are you sure you want to allow this? (y/N)

##########################################

sudo pip install virtualenvwrapper
export WORKON_HOME=~/venvs
source /usr/bin/virtualenvwrapper.sh
mkvirtualenv -p /usr/bin/python3 voseq_environment

[shenzy@LFE0530 VoSeq]$ mkvirtualenv -p /usr/bin/python3 voseq_environment
Running virtualenv with interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/shenzy/envs/voseq_environment/bin/python3
Also creating executable in /home/shenzy/envs/voseq_environment/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /home/shenzy/envs/voseq_environment/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/shenzy/envs/voseq_environment/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/shenzy/envs/voseq_environment/bin/preactivate
virtualenvwrapper.user_scripts creating /home/shenzy/envs/voseq_environment/bin/postactivate
virtualenvwrapper.user_scripts creating /home/shenzy/envs/voseq_environment/bin/get_env_details
(voseq_environment) [shenzy@LFE0530 VoSeq]$ workon voseq_environment

pip install django

pip install django-suit
pip install -r requirements.txt
#########################33

cd /home/shenzy/software/VoSeq

workon voseq_environment

source ~/.autoenv/activate.sh      #  使得能够调用 blastn 等 通过  export path

pip install django

pip install django-suit

pip install -r requirements.txt

make serve

(voseq_environment) [shenzy@LFE0530 VoSeq]$ make serve
python voseq/manage.py create_stats –settings=voseq.settings.local
python voseq/manage.py runserver –settings=voseq.settings.local
Performing system checks…

System check identified no issues (0 silenced).
July 16, 2018 – 06:10:13
Django version 1.10.4, using settings ‘voseq.settings.local’
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

 

(voseq_environment) [shenzy@LFE0530 VoSeq]$ make serve
python voseq/manage.py create_stats –settings=voseq.settings.local
python voseq/manage.py runserver –settings=voseq.settings.local
Performing system checks…

System check identified no issues (0 silenced).
July 16, 2018 – 07:02:22
Django version 1.10.4, using settings ‘voseq.settings.local’
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
^C
(voseq_environment) [shenzy@LFE0530 VoSeq]$ vi setup.py
(voseq_environment) [shenzy@LFE0530 VoSeq]$ vi runserver.py
(voseq_environment) [shenzy@LFE0530 VoSeq]$ python voseq/manage.py runserver –settings=voseq.settings.local 143.89.29.80:8000
Performing system checks…

System check identified no issues (0 silenced).
July 16, 2018 – 07:03:30
Django version 1.10.4, using settings ‘voseq.settings.local’
Starting development server at http://143.89.29.80:8000/

 

########################

[shenzy@LFE0530 VoSeq]$ sudo -u postgres -i
[postgres@LFE0530 ~]$ psql
psql (9.2.23)
Type “help” for help.

postgres=#

sudo -u postgres -i

 

920 sudo yum install postgresql postgresql-contrib postgresql-server-dev-9.3
922 sudo yum uninstall postgresql
923 sudo yum remove postgresql
924 sudo yum install postgresql
925 sudo yum install postgresql*
927 sudo yum reinstall postgresql*
931 sudo -u postgres createuser owning_user
932 sudo -u postgres createuser shenzy
933 sudo -u postgres createuser postgres
935 sudo -u postgres -i
945 sudo -u postgres -i

 

try this:

 ## Login with postgres user 
sudo -u postgres -i
 export PGDATA=/your_path/data
 pg_ctl -D $PGDATA start &

 

service postgresql start/status

SHOW data_directory;

postgres=# \q
[postgres@LFE0530 ~]$ pwd
/var/lib/pgsql
[postgres@LFE0530 ~]$ psql
psql (9.2.23)
Type “help” for help.

postgres=# SHOW data_directory;
data_directory
—————-
/home/pgsql
(1 row)

 

虽然还是显示下面错误,但其实上面的已经可以让 pgsql启动,并服务!!!

Redirecting to /bin/systemctl status postgresql.service
● postgresql.service – PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 三 2018-07-18 22:31:30 EDT; 5min ago
Process: 8035 ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o -p ${PGPORT} -w -t 300 (code=exited, status=1/FAILURE)
Process: 8029 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)

7月 18 22:31:29 LFE0530 pg_ctl[8035]: HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
7月 18 22:31:29 LFE0530 pg_ctl[8035]: LOG: could not bind IPv4 socket: Address already in use
7月 18 22:31:29 LFE0530 pg_ctl[8035]: HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
7月 18 22:31:29 LFE0530 pg_ctl[8035]: WARNING: could not create listen socket for “localhost”
7月 18 22:31:29 LFE0530 pg_ctl[8035]: FATAL: could not create any TCP/IP sockets
7月 18 22:31:30 LFE0530 pg_ctl[8035]: pg_ctl: could not start server
7月 18 22:31:30 LFE0530 systemd[1]: postgresql.service: control process exited, code=exited status=1
7月 18 22:31:30 LFE0530 systemd[1]: Failed to start PostgreSQL database server.
7月 18 22:31:30 LFE0530 systemd[1]: Unit postgresql.service entered failed state.
7月 18 22:31:30 LFE0530 systemd[1]: postgresql.service failed.
[root@LFE0530 data]#

 

voseq=# \COPY public_interface_vouchers(code,notes) FROM ‘/home/shenzy/software/VoSeq/U-RVDBv13.0.voucher_10_5000top.csv’ DELIMITER ‘,’ CSV HEADER;
voseq=#

voseq=#
\COPY public_interface_sequences FROM ‘/home/shenzy/software/VoSeq/all.gene_fasta_10test_import.csv’ DELIMITER ‘,’ CSV;
voseq=#
\COPY public_interface_sequences FROM ‘/home/shenzy/software/VoSeq/all.gene_fasta_10test_import.csv’ DELIMITER ‘,’ CSV;
voseq=#
\COPY public_interface_vouchers FROM ‘/home/shenzy/software/VoSeq/U-RVDBv13.0.voucher_import.csv’ DELIMITER ‘,’ CSV;

 

###########################
export

voseq=# COPY public_interface_sequences TO ‘/home/shenzy/software/VoSeq/testseq.csv’ WITH CSV;

 

############33

#empty table
voseq=# truncate table public_interface_sequences  CASCADE;
NOTICE:  truncate cascades to table “public_interface_primers”
TRUNCATE TABLE
voseq=# truncate table public_interface_vouchers CASCADE;
NOTICE:  truncate cascades to table “public_interface_flickrimages”
NOTICE:  truncate cascades to table “public_interface_localimages”
NOTICE:  truncate cascades to table “public_interface_sequences”
NOTICE:  truncate cascades to table “public_interface_primers”

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>